- 下载官方的补齐脚本:
curl -o ~/.git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
- 配置生效,在
~/.bash_profile
(没有就新建)中添加如下代码,之后重启Shell。
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
source ~/.git-completion.bash