Git: merge multiple commits from one branch to another

I have the following use case.

  • I have a mainline branch.
  • Created a new branch (dev) from mainline .
  • Divided several transactions (about 20) in the dev branch and clicked on the dev branch (remote).

Now I want to combine all these 20 commits into a single commit and move it to mainline . How can i do this?

Thanks Advance,
Shantanu

+5
source share
1 answer

It sounds like git merge --squash

 git checkout mainline git merge --squash dev git commit 

Note that in here it is best to combine mainline in dev and resolve any conflict there before merging dev back into mainline .

+5
source

Source: https://habr.com/ru/post/1238482/


All Articles