男人说:
包含了从git merge-file
到<base-file>
变成<other-file>
。<current-file>
将更改合并到
<current-file>
时,我想合并
与 <base-file>
的副本发生冲突的更改(我们将其命名为 <conflict-file>
)
在这种情况下,请勿触摸 <current-file>
。
这样,我就会这样结束:
<new-current-file>
已经合并了尽可能多的改变,<base-file>
和 <conflict-file>
可以不同(我更喜欢垂直 vimdiff
)
查看我必须手动合并的冲突更改
<new-current-file>
。我可以吗?
如果您可以升级到 Git 2.47(2024 年第 4 季度),第 17 批,您将看到“
git apply --3way
”(man) 学会了采取 --ours
和其他选项。
请参阅提交 57f583c(2024 年 9 月 9 日),作者:Alex Henrie (
alexhenrie
)。gitster
-- 合并于 commit 6e2a18c,2024 年 9 月 16 日)
:支持apply
、--ours
和--theirs
三向合并--union
签字人:Alex Henrie
、--ours
和--theirs
已在--union
(man) 中受支持,用于自动解决有利于一个版本或另一个版本的冲突,而不是在文件中留下冲突标记.git merge-file
也可以在(man) 中支持它们,因为这两个命令执行相同类型的文件级合并。git apply -3
如果将来
、--ours
和--theirs
获得三路合并之外的含义,它们并不意味着 --3way,而是必须在其旁边指定。--union
git apply
现在包含在其 手册页中:
git apply [--stat] [--numstat] [--summary] [--check] [--index | --intent-to-add] [--3way] [--ours | --theirs | --union]
git apply
现在包含在其 手册页中:
--ours
--theirs
--union
不要将冲突留在文件中,而是解决有利于冲突的冲突 我们(或他们或双方)的一方。需要--3way。