In the command:
bashgit diff --word-diff=color --word-diff-regex=.
The --word-diff=color option highlights changes within lines by coloring the differences. The --word-diff-regex=. makes it so that every single character is treated as a "word" for the purpose of diffing, which means it will highlight every changed character in the diff.
If you change a line from:
bashhello world
to:
bashhello git
The output will highlight:
world in red (removed)git in green (added)If you want to customize the colors, you can use Git's color.diff configuration. For example:
bashgit config --global color.diff.old "red bold" git config --global color.diff.new "green bold"
This will make removed text bold red and added text bold green.
--color-wordsYou can also use:
bashgit diff --color-words
This is a shorthand for --word-diff=color --word-diff-regex=. and achieves the same effect.
Vibe can make mistakes. Check answers. Learn more