git diff [HEAD|--staged...] --word-diff
Rather than displaying lines changed, this will display differences within lines. For example, rather than:
-Hello world
+Hello world!
Where the whole line is marked as changed, word-diff
alters the output to:
Hello [-world-]{+world!+}
You can omit the markers [-
, -]
, {+
, +}
by specifying --word-diff=color
or --color-words
. This will only use color coding to mark the difference: