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

前端 未结 18 1527
傲寒
傲寒 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:58

    To really properly do a merge which takes only input from the branch you are merging you can do

    git merge --strategy=ours ref-to-be-merged

    git diff --binary ref-to-be-merged | git apply --reverse --index

    git commit --amend

    There will be no conflicts in any scenario I know of, you don't have to make additional branches, and it acts like a normal merge commit.

    This doesn't play nice with submodules however.

提交回复
热议问题