Merge diff between two branches to third branch

前端 未结 2 1428
迷失自我
迷失自我 2021-02-06 09:09

Assume I have two branches, master and new_feature

I was supposed to work on a specific feature, I thought this feature would be part of

2条回答
  •  感动是毒
    2021-02-06 09:59

    You may use use the command git cherry to retrieve the commit done on the specific_feature branch and which does not appear on the origin/new_feature branch.

    git cherry origin/new_feature specific_feature
    

    You can then create a new branch from master and cherry-pick all these commits. But if you dependencies between your development on specific_feature and origin/new_feature no scm is going to resolve that for you.

    git checkout -b specific_feature_master master
    git cherry origin/new_feature specific_feature | egrep '^+' | awk '{print $2} | xargs git cherry-pick
    

    Something like that should do starting point for resolving your problem.

提交回复
热议问题