Programming
git terminal alias
Updated Sun, 04 Sep 2022 12:52:15 GMT

List Git aliases


How do I print a list of my git aliases, i.e., something analogous to the bash alias command?




Solution

Just adding this because it's so simple and I didn't see it in previous answers (sorry if I missed it).

git help -a

You'll have to scroll to the bottom to see the list, e.g.:

Command aliases
   restore-deleted      !git restore $(git ls-files -d)

If you forget even this switch, a simple git help will help you remember:

'git help -a' and 'git help -g' list available subcommands and some concept guides. See 'git help ' or 'git help ' to read about a specific subcommand or concept.





Comments (1)

  • +1git help -a displays in less for me, so I can type G or > to jump to the last line. Or you can just run git help -a | sed '1,/aliases$/d'. I added that command as an alias in my global Git configuration file by running git config --global alias.alias "\!git help -a | sed '1,/aliases$/d'". Now I can just run git alias to list my Git aliases. — Sep 02, 2022 at 21:38