.gitattributes合并驱动程序未使用

黑色眼睛

首先,我知道这个问题,我该如何告诉git始终为特定文件上的冲突合并选择本地版本?但是这篇文章对我没有帮助,并且由于我的声誉我无法添加任何评论。

http://git-scm.com/book/zh-CN/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>

我究竟做错了什么?

VonC

您可以声明一个合并驱动程序,但这意味着您必须在git config上对其进行定义,如“ .gitattributes&&一个文件的单独合并策略”中所示:

[merge "ours"]
    name = "Keep ours merge"
    driver = true

这样就可以为文件或文件集提供合并策略,而不是-s策略选项,该策略不需要您定义驱动程序,但是可以解决所有文件的冲突(不仅限于git merge pom.xml

git merge -s ours

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章