.gitattributes合并策略

the*_*nix 8 git

我尝试将合并策略添加到我的存储库中的.gitattributes文件中.但是当我将另一个分支与该(不同的)文件合并时,会导致合并冲突 - 自动合并失败.

这是我尝试做的事情.

.gitattributes:

backend/library/project/config.php merge=ours
Run Code Online (Sandbox Code Playgroud)

分行:

  • 生产
  • 分期

在生产中我有config.php'A,并在分阶段我有config.php'B.

> git checkout production

> git merge staging 

> Auto-merging backend/library/project/config.php
> CONFLICT (content): Merge conflict in backend/library/project/config.php
> Automatic merge failed; fix conflicts and then commit the result.
Run Code Online (Sandbox Code Playgroud)

我尝试将行添加到.git/info/attributes以及向.merge ="ours"添加引号.

有谁知道我做错了什么?(Git-version是1.7.4.4)thx

ulm*_*ngt 3

有两个很好的 Stack Overflow 响应可以解决这个问题:

如何告诉 git 始终选择本地版本来进行特定文件上的冲突合并?

.gitattributes 和文件的单独合并策略

我建议阅读第一个链接中的最佳答案。它很长,但非常详细且内容丰富。

  • 请将问题标记为重复,而不是链接到 SO 问题。 (7认同)