I have following use case.
Now I want to merge all these 20 commits into single commit and move this to mainline. How exactly I can do this?
Thanks in Advance,
Shantanu
Git squash with a commit id The last command opens the interactive Git rebase tool which lists all of the commits in the branch. You must type the word pick next to the commit you want all others to be squashed into. Then type 'squash', or just the letter 's', next to each commit to squash.
You can use git merge --squash to squash the commits into a single one while merging into the branch. All the commits in original-branch will be merged into a single one, and applied to the target-branch .
That sounds like a git merge --squash
git checkout mainline
git merge --squash dev
git commit
Note that, as commented here, it is best to merge mainline
in dev
first and solve any conflict there, before merging back dev
in mainline
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With