This article例如详细解释了虚拟对象的差异算法,但是什么是使用的实际算法?
有关diff2
&的规格的一般知识。 diff3
。
diff2
:http://www.xmailserver.org/diff2.pdf diff3
:http://www.cis.upenn.edu/~bcpierce/papers/diff3-short.pdf 我知道您可以将git配置为使用diff2
或diff3
git config --global merge.conflictstyle diff3
答案 0 :(得分:4)
你好像混淆了3个不同的东西
diff3
diff3
是非默认选项)Git支持4种不同的diff算法。
您可以通过命令行指定git diff
--minimal
Spend extra time to make sure the smallest possible diff is produced.
--patience
Generate a diff using the "patience diff" algorithm.
--histogram
Generate a diff using the "histogram diff" algorithm.
--diff-algorithm={patience|minimal|histogram|myers}
Choose a diff algorithm. The variants are as follows:
default, myers
The basic greedy diff algorithm. Currently, this is the default.
minimal
Spend extra time to make sure the smallest possible diff is produced.
patience
Use "patience diff" algorithm when generating patches.
histogram
This algorithm extends the patience algorithm to "support low-occurrence common elements".
或通过git配置。
diff.algorithm
Choose a diff algorithm. The variants are as follows:
default, myers
The basic greedy diff algorithm. Currently, this is the default.
minimal
Spend extra time to make sure the smallest possible diff is produced.
patience
Use "patience diff" algorithm when generating patches.
histogram
This algorithm extends the patience algorithm to "support low-occurrence common elements".
原始问题中的diff2
pdf-link是对myers
算法的描述,似乎与{diff2
中的双向冲突标记merge.conflictStyle
无关。 1}}。
同样,unix工具diff3
与3方冲突标记git调用diff3
无关。
答案 1 :(得分:0)
我在config documentation中找到了答案:
git默认值是diff2
merge.conflictStyle
指定在合并时将冲突的帅哥写入工作树文件的样式。
默认为“merge”,显示<<<<<<<<<<冲突标记,
由一方做出的改变,a =======标记,
另一方做出的改变,
然后是>>>>>>>>标记。另一种风格,“diff3”,添加|||||||标记和=======标记之前的原始文本。