如果我指定了-Xours,怎么会有合并冲突?

huangapple go评论64阅读模式
英文:

How can there be a merge conflict if I specified -Xours?

问题

"-Xours"应该意味着在合并过程中始终选择一个选项。那么为什么我仍然会遇到合并冲突?

英文:

-Xours should mean that during merging one option always gets picked. So why do I still get merge conflicts?

答案1

得分: 1

"-Xours" 应该意味着在合并过程中始终选择一种选项。请注意,选项"-Xours"(以及"-Xtheirs")会对双方进行常规合并,只有在存在冲突时才会选择一方。自动冲突解决仅适用于与冲突相关的行,而不适用于整个文件。然而,关键在于,只有当两个文件都被修改时,自动冲突解决才起作用。如果至少一方添加或删除而不是修改,则不会执行自动解决。这可能是您的情况中出现一些冲突的原因。

英文:

Perhaps you know this already but the way you stated the premise isn't exactly right:

> -Xours should mean that during merging one option always gets picked.

Note that the option -Xours (and also -Xtheirs) does a regular merge of both sides, and only when there is a conflict will it choose one side or the other. The automatic conflict resolution is for just the lines involved in the conflict, not the entire file.

The key though is that the automatic conflict resolution only works when both files are modified. If at least one side is added or deleted instead of modified it will not perform automatic resolution. Presumably this is why it's happening for some of the conflicts in your case.

huangapple
  • 本文由 发表于 2023年6月6日 07:48:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/76410627.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定