What do I have to write in the .gitconfig
file in order for git diff
to behave as it was git diff --word-diff
?
For now, searching for \bword
in man git-config
I've found diff.wordRegex
, and given that
The name is actually the section and the key separated by a dot
from the same man page, I've verified that
[diff]
wordRegex = some-regex
affects the diff when I run git diff --word-diff
. For instance, wordRegex = "."
causes a character-wise diff.
But how do I tell git
to always use --word-diff
(or --color-words
, fwiw)?
I know aliases exist, and I use some, but I was curious if there's an option.
Of the two answers at a similar question,
- the first one suggests to use an alias, which is not what I'm looking for, as written above;
- the second one is about GUI, which I'm not interested into either.
git config --global alias.diff "diff --word-diff"
. FWIW, I use the alias namewd
for this. – Reprovalgit wd
is the way to go. – Japanese