I sometimes use git diff
with a --color-words='\w+|.'
option to get the changes displayed inline and for whole words only.
Since I noticed that I'm using it a bit, I've made a git alias for diff --color-words='\w+|.'
.
But now I notice, there are many other places where I'd like to use the same option, like git show
, git stash show -p
, git log -p
and more probably. So it's impossible to predict where I might need that option in the future.
I've tried this:
$ git config --global alias.words "--color-words='\w+|.'"
$ git diff words
fatal: ambiguous argument 'words': unknown revision or path not in the working tree
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
And this:
$ git config --global alias.--words "--color-words='\w+|.'"
error: invalid key: alias.--words
Is there any way to create an alias to an arduous option, so I can use it with various commands and save on typing and thinking?