In my git config, I have a relatively long alias which outputs a log of recent git commits in a pretty format:
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'
I also have another alias which builds on the previous one by adding the --all
option the the command. I didn't want to repeat myself by specifying the entire command string in both aliases, so I just had my new alias shell out to the previous one:
la = !git lg --all
This works quite well, but there's a problem: while autocompletion of branch names works fine with my regular git lg
alias, it doesn't work at all for the one that shells out.
How can I make autocompletion of git branch names work with aliases that shell out to other commands?
Note: This question is distinct from How do I get bash completion to work with aliases?, because that question deals with bash aliases of git commands, and not git's built-in alias system.