下载自动补全提示文件:
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
在~/.bash_profrile中加入:
if [ -f ~/.git-completion.bash ]; then. ~/.git-completion.bash
fi
(PS: If this doesn't work off the bat, you may need to run chmod
-X ~/.git-completion.bash
to give the script permission to run.)
亲测可以起作用。
参考:http://apple.stackexchange.com/questions/55875/git-auto-complete-for-branches-at-the-command-line