5

I have following use case.

  1. I have a mainline branch.
  2. Created new branch(dev) from mainline.
  3. Did multiple commits(around 20) into dev branch and pushed into dev(remote) branch as well.

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

shantanu
  • 1,748
  • 3
  • 19
  • 34

1 Answers1

9

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250