git merge-file:如何将冲突合并到<base-file>?

问题描述 投票:0回答:1

男人说:

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 git-merge-conflict
1个回答
0
投票

如果您可以升级到 Git 2.47(2024 年第 4 季度),第 17 批,您将看到“

git apply --3way
(man) 学会了采取
--ours
和其他选项。

请参阅提交 57f583c(2024 年 9 月 9 日),作者:Alex Henrie (

alexhenrie
)
(由 Junio C Hamano --
gitster
--
合并于 commit 6e2a18c,2024 年 9 月 16 日)

apply
:支持
--ours
--theirs
--union
三向合并

签字人:Alex Henrie

--ours
--theirs
--union
已在
git merge-file
(man) 中受支持,用于自动解决有利于一个版本或另一个版本的冲突,而不是在文件中留下冲突标记.
也可以在
git apply -3
(man) 中支持它们,因为这两个命令执行相同类型的文件级合并。

如果将来

--ours
--theirs
--union
获得三路合并之外的含义,它们并不意味着 --3way,而是必须在其旁边指定。

git apply
现在包含在其 手册页中:

git apply [--stat] [--numstat] [--summary] [--check]
[--index | --intent-to-add] [--3way] [--ours | --theirs | --union]

git apply
现在包含在其 手册页中:

--ours

--theirs

--union

不要将冲突留在文件中,而是解决有利于冲突的冲突 我们(或他们或双方)的一方。需要--3way。

© www.soinside.com 2019 - 2024. All rights reserved.