As a follow up to this question, I asked myself if it would be possible to tell git to provide it's autocomplete feature (branches etc.) for further commands, in particular plumbing commands like update-ref
.
Although update-ref
provides more flexibility than branch -f
, it's quite a hassle to use since you always have to type the full reference name. Which in turn doesn't make me want to use it.
Any ideas on this?
It is possible to enable the plumbing commands but you will need to provide some of the implementation yourself.
Find the
git-completion.sh
script you are using.In my
/users/andrewc/.bashrc
I haveSo I pull up
/users/andrewc/git-completion.bash
Find the function
__git_list_porcelain_command())
and comment out the line forupdate-ref
This will allow
update-ref
itself to autocomplete. The script won't know how to fill in any of the args toupdate-ref
though. It looks like you will need to provide an implementation for__git_update_ref
to achieve this. I would use a similar command (`__git_branch maybe) as a template and go from there.