如何在 Git 存储库之外使用“git diff --color-words”?
如何在 Git 之外获得类似于 git diff --color-words 中的输出?
最接近的是 wdiff -t ,但它强调/反转事物而不是使用绿色/红色,并且不允许指定我的空白正则表达式。
How can I get output like in git diff --color-words
, but outside Git?
Closest thing is wdiff -t
, but it underlines/inverts things instead of using green/red colours and does not allow specifying my whitespace regex.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
根据 Jefromi 的评论,你
也可以在 git 存储库之外使用。
According to a comment from Jefromi you can just use
outside of git repositories too.
如果我在 git 存储库 (git v2.3.3) 中:
git diff --color-words
不起作用(无输出)git diff --no-index
> 不接受--color-words
也不接受--color
参数使用 wdiff 是可能的,配置为使用颜色,而不是下划线:
来源:https://www.gnu.org/software/wdiff/manual/html_node /wdiff-Examples.html (修改为使用前景色而不是背景色)
希望有帮助。
If I'm inside a git repository (git v2.3.3) :
git diff --color-words
doesn't work (no output)git diff --no-index
doesn't accept--color-words
nor--color
argumentsUsing wdiff is possible, configured to use colors, rather than underlined :
Source : https://www.gnu.org/software/wdiff/manual/html_node/wdiff-Examples.html (modified to use foreground colors rather than background colors)
Hope it helps.
Git 版本 1.9.1:
git diff --word-diff=color fileA fileB
Git version 1.9.1:
git diff --word-diff=color fileA fileB
你可以说 git diff --color=always --color-words ,这将为你提供输出中的颜色转义代码。不过,你将有一些 shell 来解释颜色代码……
you can say
git diff --color=always --color-words
, which will give you the color escape codes in the output. you are going to have some shell to interpret the color codes though …