Thursday, 15 March 2012

How do I get bash autocomplete to work with git aliases that use shell commands? -



How do I get bash autocomplete to work with git aliases that use shell commands? -

in git config, have relatively long alias outputs log of recent git commits in pretty format:

lg = log --color --graph --pretty=format:'%cred%h%creset -%c(yellow)%d%creset %s %cgreen(%ar) %c(bold blue)<%an>%creset'

i have alias builds on previous 1 adding --all alternative the command. didn't want repeat myself specifying entire command string in both aliases, had new alias shell out previous one:

la = !git lg --all

this works quite well, there's problem: while autocompletion of branch names works fine regular git lg alias, doesn't work @ 1 shells out.

how can create autocompletion of git branch names work aliases shell out other commands?

note: question distinct how bash completion work aliases?, because question deals bash aliases of git commands, , not git's built-in alias system.

in case typing branch name give same results because --all alternative shows refs. if add

function _git_la() { _git_log }

to shell startup file should autocomplete correctly.

git bash shell

No comments:

Post a Comment