简体   繁体   English

是否可以在 gitk 中配置差异?

[英]Is it possible to configure the diff in gitk?

When clicking a file in gitk it is compared to the previous version of this file.在 gitk 中单击文件时,会将其与该文件的先前版本进行比较。 It looks like the files are compared with git diff, and it's possible to configure very few parameters (basically the number of lines to view around each diff, "Lines of context").看起来这些文件与 git diff 进行了比较,并且可以配置非常少的参数(基本上是要在每个 diff 周围查看的行数,“上下文行”)。

Is it possible to somehow configure the diff of gitk further?是否有可能以某种方式进一步配置 gitk 的差异? I would like it to run git diff --word-diff=color instead of git diff when i click a file.我希望它在我单击文件时运行 git diff --word-diff=color 而不是 git diff。 Would something like that be possible?这样的事情可能吗?

If it is the setting is pretty well hidden.如果它是设置隐藏得很好。

The dropdown to choose this option is right above the diff pane on the right. 选择此选项的下拉菜单位于右侧“差异”窗格的上方。 Default is "line diff", you want "color words" 默认为“行差异”,要“颜色词”

For completeness, gitk also accepts command line options, and launching it as follows leads to the same result as the accepted answer:为了完整起见,gitk 还接受命令行选项,按如下方式启动它会导致与接受的答案相同的结果:

gitk --word-diff=color

More specifically, the gitk man page states that更具体地说, gitk 手册页指出

[gitk] also supports a few options applicable to the git diff-* commands to control how the changes each commit introduces are shown. [gitk] 还支持一些适用于git diff-*命令的选项,以控制每次提交引入的更改的显示方式。

Apparently, --word-diff is among the supported options.显然, --word-diff是受支持的选项之一。 I don't know if this is system or configuration-dependent though (I tested it on git 2.39.0 in git-bash on Windows 10).我不知道这是系统依赖还是配置依赖(我在 Windows 10 的 git-bash 中的 git 2.39.0 上测试了它)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM