Git allows you to create your own custom Git verbs, or aliases, using
git config [--global] alias.<alias-name> "<replacement-text>"
If you're not very familiar with Git commands, though, you may choose an alias name that corresponds to an existing Git verb; as an extremely dumb example, consider
git config --global alias.log show
No panic; according to git config --help
:
To avoid confusion and troubles with script usage, aliases that hide existing Git commands are ignored.
Fine, but, in that case, Git won't tell you that your new alias will be ignored.
Therefore, I'm wondering whether there is a robust (and future-proof) way of checking whether my prospective alias name correspond to an existing Git verb, before actually defining the alias.
I was thinking of searching for <alias-name>
in the output of git help --all
, but the latter contains more than just a list of all Git verbs, so I'm not sure how robust such an approach would be...
Any idea?
Sure, just run git help <command name>
.
'git l' is aliased to 'log'