Expand git's autocomplete feature to plumbing commands

偶尔善良 提交于 2019-12-06 05:05:56

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 have

# GIT STUFF 
if [ -f ~/.git-completion.bash ] 
then
    . ~/.git-completion.bash 
fi

So I pull up /users/andrewc/git-completion.bash

Find the function __git_list_porcelain_command()) and comment out the line for update-ref

        #update-ref)       : plumbing;;

This will allow update-ref itself to autocomplete. The script won't know how to fill in any of the args to update-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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!