How to copy commits from one branch to another

后端 未结 2 1773
别跟我提以往
别跟我提以往 2021-02-14 19:36

I have two features I\'m working on

Shared -- Commits -- A -- B -- C Feat1

Shared -- Commits -- D -- E -- F Feat2

The problem is that to test Feat2 I rea

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-14 20:22

    There are basically two options here.

    1. You can use cherry-pick to copy the new commits on feat2 to combo.
    2. Instead of rebasing, you can merge

    Cherry Picking

    To cherry pick new commits on feat2 to combo, run the following:

    git checkout combo
    git cherry-pick   
    

    Merging

    Or alternately, you can merge instead of rebasing. E.g. To create combo:

    git checkout -b combo feat1
    git merge feat2
    

    Then, to "merge in new changes" from feat2, just...

    git merge feat2
    

    Likewise, to merge in new commits on feat1:

    git merge feat1
    

提交回复
热议问题