Manuela Hutter Manuela Hutter - 10 months ago 63
Git Question

Disable auto-completion of remote branches in Git Bash?

I'm working on a fairly large git repo with a couple of thousand (remote) branches. I am used to using auto-completion (using [TAB]) in the console (Git Bash in that case), so I unconsciously do that for git commands, too.

e.g. I'd type

git checkout task[TAB]

with the effect that the console stalls for often minutes. Is there a way to limit auto-completion to local branches only?


You can hack /etc/bash_completion.d/git

You'll need to edit __git_refs ()

Note that the change in behaviour will apply every where (so even with git push/pull where you might not want it to). You could of course, make a copy of the function or pass an extra parameter, but I leave that to you