How to automatically resolve a Git conflict by taking the version in the current branch?

前端 未结 2 587
执念已碎
执念已碎 2021-02-01 04:05

Let\'s suppose that I get a merge conflict on foo/bar.txt when running this:

$ git checkout A
$ git merge B

I\'d like to automatic

2条回答
  •  悲&欢浪女
    2021-02-01 04:37

    You can specify the merge strategy option ours to the recursive (the default) merge strategy. It will do a normal merge, but in case of conflicting hunks will choose the version of the current branch.

    git checkout A
    git merge -Xours B
    

提交回复
热议问题