【问题标题】:.gitattributes merge strategy [duplicate].gitattributes 合并策略
【发布时间】:2012-02-13 17:07:30
【问题描述】:

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

这是我尝试做的。

.git 属性:

backend/library/project/config.php merge=ours

分支机构:

  • 生产
  • 分期

在生产中我有 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.

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

有人知道我做错了什么吗? (Git 版本是 1.7.4.4) 谢谢

【问题讨论】:

    标签: git


    【解决方案1】:

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

    How do I tell git to always select my local version for conflicted merges on a specific file?

    .gitattributes & individual merge strategy for a file

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

    【讨论】:

    • 不要链接到 SO 问题,而是将问题标记为重复。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-08
    • 2020-11-21
    • 1970-01-01
    • 2010-12-04
    • 2020-02-05
    相关资源
    最近更新 更多