在黑窗口中依次输入以下命令即可:
1.获取所有git-completion.bash命令
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
2.添加到 .bash_profile
vim ~/.bash_profile
2-1.追加内容以下内容后,保存退出
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
3.执行刷新命令
source ~/.bash_profile