如何使 `git diff` 像 StackExchange diff 一样细粒度?
How can I make `git diff` as fine-grained as StackExchange diff?
是否有 diff 工具可以突出显示单个字符的编辑,而不仅仅是显示整行的新旧版本(即 StackExchange 向您显示编辑 post 的那种 diff) )?
我更喜欢可以在 Linux 命令行上使用的一个,如 git
中的 diff
。
你可以试试,来自git diff
:
git diff --color-word=.
相当于 --word-diff=color
加上(如果指定了正则表达式)--word-diff-regex=<regex>
.
这将改变这个 git diff
:
进入这个:
图片来自“Produce more useful diffs" of the article "30 Git CLI options you should know about" written in Sept. 2014 by Christophe Porteneuve.
部分
是否有 diff 工具可以突出显示单个字符的编辑,而不仅仅是显示整行的新旧版本(即 StackExchange 向您显示编辑 post 的那种 diff) )?
我更喜欢可以在 Linux 命令行上使用的一个,如 git
中的 diff
。
你可以试试,来自git diff
:
git diff --color-word=.
相当于 --word-diff=color
加上(如果指定了正则表达式)--word-diff-regex=<regex>
.
这将改变这个 git diff
:
进入这个:
图片来自“Produce more useful diffs" of the article "30 Git CLI options you should know about" written in Sept. 2014 by Christophe Porteneuve.
部分