4

When clicking a file in gitk it is compared to the previous version of this file. 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").

Is it possible to somehow configure the diff of gitk further? I would like it to run git diff --word-diff=color instead of git diff when i click a file. Would something like that be possible?

If it is the setting is pretty well hidden.

Martin G
  • 17,357
  • 9
  • 82
  • 98

2 Answers2

10

The dropdown to choose this option is right above the diff pane on the right. Default is "line diff", you want "color words"

knittl
  • 246,190
  • 53
  • 318
  • 364
2

For completeness, gitk also accepts command line options, and launching it as follows leads to the same result as the accepted answer:

gitk --word-diff=color

More specifically, the gitk man page states that

[gitk] also supports a few options applicable to the git diff-* commands to control how the changes each commit introduces are shown.

Apparently, --word-diff is among the supported options. 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).

simon
  • 1,503
  • 8
  • 16