首先我知道这个问题如何告诉 git 始终选择本地版本来进行特定文件上的冲突合并?但这篇文章对我没有帮助,而且由于我的声誉,我无法添加任何评论。
http://git-scm.com/book/en/Customizing-Git-Git-Attributes建议将合并策略设置为我们的路径,而不是设置自定义合并驱动程序。
添加自定义合并驱动程序返回退出代码 0 有什么好处和区别?
我的存储库顶层有一个 .gitattributes 文件:
pom.xml merge=ours
但是当我将两个分支与更改的 pom.xml 文件合并时,合并无法解决:
$ git merge origin/master
Auto-merging pom.xml
CONFLICT (content): Merge conflict in pom.xml
Automatic merge failed; fix conflicts and then commit the result.
我得到一个标准的合并冲突结果:
<pom>
<<<<<<< HEAD
<version>0.88-SNAPSHOT</version>
=======
<version>0.87.0</version>
>>>>>>> origin/master
</pom>
我究竟做错了什么?
您可以声明合并驱动程序,但这意味着您必须在 git config 上定义它,如“":
[merge "ours"]
name = "Keep ours merge"
driver = true
这允许对一个文件或一组文件进行合并策略,而不是-s
选项git merge 策略,这不需要您定义驱动程序,但可以解决冲突all文件(不仅仅是为了pom.xml
)
git merge -s ours
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)