我刚刚阅读了Git 2.35.0发行说明 (注2.35.1已经可用)。
在这些新闻稿中,我看到:
我的问题:
发布于 2022-02-24 15:08:38
新的“狂热的diff3”风格是:
merge.conflictStyle = zdiff3你会用:
git config --global merge.conflictStyle zdiff3例如(假设您希望在每个用户的配置中这样做)。
默认的样式是merge
Here are lines that are either unchanged from the common
ancestor, or cleanly resolved because only one side changed,
or cleanly resolved because both sides changed the same way.
<<<<<<< yours:sample.txt
Conflict resolution is hard;
let's go shopping.
=======
Git makes conflict resolution easy.
>>>>>>> theirs:sample.txt
And here is another line that is cleanly resolved or unmodified.(本例直接取自文档)。diff3样式在中间添加了合并基版本,并带有垂直条:
Here are lines that are either unchanged from the common
ancestor, or cleanly resolved because only one side changed,
<<<<<<< yours:sample.txt
or cleanly resolved because both sides changed the same way.
Conflict resolution is hard;
let's go shopping.
||||||| base:sample.txt
or cleanly resolved because both sides changed identically.
Conflict resolution is hard.
=======
or cleanly resolved because both sides changed the same way.
Git makes conflict resolution easy.
>>>>>>> theirs:sample.txt
And here is another line that is cleanly resolved or unmodified.请注意,为了显示基本版本和两个分支提示版本之间的差异,行:
or cleanly resolved because both sides changed the same way.它以前在<<<<<<< ... >>>>>>>部分之外(因为它是干净解析的)现在在这个部分中。
zdiff3所做的是采取与merge相同的“或清晰解决”路径:
Here are lines that are either unchanged from the common
ancestor, or cleanly resolved because only one side changed,
or cleanly resolved because both sides changed the same way.
<<<<<<< yours:sample.txt
Conflict resolution is hard;
let's go shopping.
||||||| base:sample.txt
or cleanly resolved because both sides changed identically.
Conflict resolution is hard.
=======
Git makes conflict resolution easy.
>>>>>>> theirs:sample.txt
And here is another line that is cleanly resolved or unmodified.这是某种程度上的谎言,但这是一个有用的谎言。
请注意,如果您愿意,可以接受任何现有的冲突文件,并以新的合并样式重新创建冲突:
git checkout --conflict=zdiff3 conflicted.txt( git restore也是如此,但我还没有重新训练我的手指)。对此要小心,因为它覆盖了您对合并所做的任何尝试。
https://stackoverflow.com/questions/71252026
复制相似问题