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

前端 未结 18 1765
傲寒
傲寒 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 06:56

    A simple and intuitive (in my opinion) two-step way of doing it is

    git checkout branchB .
    git commit -m "Picked up the content from branchB"
    

    followed by

    git merge -s ours branchB
    

    (which marks the two branches as merged)

    The only disadvantage is that it does not remove files which have been deleted in branchB from your current branch. A simple diff between the two branches afterwards will show if there are any such files.

    This approach also makes it clear from the revision log afterwards what was done - and what was intended.

提交回复
热议问题