Is there a “theirs” version of “git merge -s ours”?

前端 未结 18 1791
傲寒
傲寒 2020-11-22 06:42

When merging topic branch \"B\" into \"A\" using git merge, I get some conflicts. I know all the conflicts can be solved using the version in \"B\".

I a

18条回答
  •  忘了有多久
    2020-11-22 07:04

    I think what you actually want is:

    git checkout -B mergeBranch branchB
    git merge -s ours branchA
    git checkout branchA
    git merge mergeBranch
    git branch -D mergeBranch
    

    This seems clumsy, but it should work. The only think I really dislike about this solution is the git history will be confusing... But at least the history will be completely preserved and you won't need to do something special for deleted files.

提交回复
热议问题