How to use git merge --squash?

后端 未结 13 1597
夕颜
夕颜 2020-11-22 05:41

I have a remote Git server, here is the scenario which I want to perform:

  • For each bug/feature I create a different Git branch

  • I keep on com

13条回答
  •  轮回少年
    2020-11-22 06:01

    You want to merge with the squash option. That's if you want to do it one branch at a time.

    git merge --squash feature1
    

    If you want to merge all the branches at the same time as single commits, then first rebase interactively and squash each feature then octopus merge:

    git checkout feature1
    git rebase -i master
    

    Squash into one commit then repeat for the other features.

    git checkout master
    git merge feature1 feature2 feature3 ...
    

    That last merge is an "octopus merge" because it's merging a lot of branches at once.

    Hope this helps

提交回复
热议问题