首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >git使用的diff版本是什么?diff2还是diff3?

git使用的diff版本是什么?diff2还是diff3?
EN

Stack Overflow用户
提问于 2015-12-23 11:32:22
回答 2查看 3K关注 0票数 4

有人知道git使用哪个不同版本吗?

例如,这篇文章详细解释了虚拟人的差分算法,但是实际使用的算法是什么?

对于一般知识,这里是diff2diff3的规范。

我知道您可以将git配置为使用diff2diff3

代码语言:javascript
复制
git config --global merge.conflictstyle diff3
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-12-23 11:43:56

我在配置文档上找到了答案

git默认值为diff2

merge.conflictStyle 指定合并时将冲突块写入工作树文件的样式。 默认情况是“合并”,它显示了一个<<<<<<<冲突标记, 由一侧,=======标记所做的更改, 另一方的改变, 然后是一个>>>>>>>标记。另一种风格, "diff3",会在=======标记之前添加一个财政记录符号和原始文本。

票数 0
EN

Stack Overflow用户

发布于 2015-12-23 18:12:31

你似乎混淆了三种不同的东西

  1. unix命令行工具diff3GNU衍射提供
  2. git提供的diff的输出格式(其中diff3是一个非默认选项)。
  3. git用于生成diff的算法。

Git支持4种不同的差分算法。

您可以通过命令行向git diff指定

代码语言:javascript
复制
  --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配置。

代码语言:javascript
复制
  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链接是对myers算法的描述,似乎与merge.conflictStyle中的双向冲突标记git调用diff2无关。

类似地,unix工具diff3与3路冲突标记git调用diff3无关。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34434750

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档