什么是diff版本git使用? diff2或diff3? [英] What is the diff version git use? diff2 or diff3?
问题描述
有没有人有线索,这是git使用的差异版本?
这篇文章例如详细解释了傻瓜算法的diff算法,但是什么是实际的算法呢?
这里指定 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
您似乎混淆了3种不同的东西
- unix命令行工具
diff3
由 GNU diffutils - git提供的diff的输出格式(其中
diff3
是一个非默认选项) - git用于创建的算法erate the diff
Git支持4种不同的差异算法。
您可以通过命令行指定 git diff
--minimal
花费额外时间确保生成最小可能的差异。
--patience
使用耐心差异算法生成差异。
--histogram
使用直方图差异算法生成差异。
--diff-algorithm = {patience | minimal | histogram | myers}
选择一种差异算法。变体如下:
default,myers
基本贪婪diff算法。目前,这是默认设置。
最小值
花费额外时间确保生成最小可能的差异。
耐心
在生成补丁时使用耐心差异算法。
直方图
此算法将耐心算法扩展为支持低出现率的通用元素。
或通过git配置。
diff.algorithm
选择一种差异算法。变体如下:
default,myers
基本的贪婪diff算法。目前,这是默认设置。
最小值
花费额外时间确保生成最小可能的差异。
耐心
在生成补丁时使用耐心差异算法。
直方图
此算法将耐心算法扩展为支持低出现率的通用元素。
原始文件中的 diff2
pdf-link问题是对 myers
算法的描述,并且似乎与双向冲突标记git调用 diff2
无关。在 merge.conflictStyle
。
同样,unix工具 diff3
与三向冲突标记git调用 diff3
无关。
Does anyone has clue which is the diff version used by git?
This article for example explain in details the diff algorithm for dummies but whats is the actual algorithm which is used?
For general knowledge here specs for diff2
& diff3
.
diff2
: http://www.xmailserver.org/diff2.pdfdiff3
: http://www.cis.upenn.edu/~bcpierce/papers/diff3-short.pdf
I know you can configure git to use diff2
or diff3
git config --global merge.conflictstyle diff3
You seem to be confusing 3 different things
- The unix command line tool
diff3
provided by GNU diffutils - The output format of the diff that git provides (in which
diff3
is a non-default option) - The algorithm that git uses to generate the diff
Git supports 4 different diff algorithms.
You can specify via the command line to 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".
or via git configuration.
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".
The diff2
pdf-link in your original question is a description of the myers
algorithm, and seems to be unrelated to the 2-way conflict markers git calls diff2
in merge.conflictStyle
.
Similarly, the unix tool diff3
is unrelated to the 3-way conflict markers git calls diff3
.
这篇关于什么是diff版本git使用? diff2或diff3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!