例如,本文详细解释了虚拟变量的diff算法,但是实际使用的算法是什么?
有关常识,请参见diff2&的规范diff3。
diff2:http://www.xmailserver.org/diff2.pdfdiff3:http://www.cis.upenn.edu/~bcpierce/papers/diff3-short.pdf我知道您可以配置git使用diff2或diff3
git config --global merge.conflictstyle diff3
Run Code Online (Sandbox Code Playgroud)
您似乎混淆了三件事
diff3提供的unix命令行工具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".
Run Code Online (Sandbox Code Playgroud)
或通过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".
Run Code Online (Sandbox Code Playgroud)
diff2您原始问题中的pdf链接是对该myers算法的描述,似乎与git调用diff2中的2向冲突标记无关merge.conflictStyle。
同样,unix工具diff3与git调用3向冲突标记无关diff3。
| 归档时间: |
|
| 查看次数: |
1555 次 |
| 最近记录: |