Mac 设置git命令tab自动补全(亲测有效)

转载 :https://blog.csdn.net/tiancaijyy/article/details/84888868

 

注意:

获取git-completion.bash  要对应自己的git版本   (git --version 查看)

访问  https://raw.githubusercontent.com/git/git/v2.17.2/contrib/completion/git-completion.bash

获取到的git-completion.bash  放入  /usr/local/opt/bash-completion/etc/bash_completion.d/

终端输入 :

brew unlink bash-completion

brew link bash-completion

重启终端后生效

 

如果mac  shell用的不是 bash 以上就没效果了

mac终端bash、zsh、oh-my-zsh最实用教程https://blog.csdn.net/www1575066083/article/details/103164811

 

 

 

 

curl  https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash

# 添加到 .bash_profile 
vim ~/.bash_profile 

# 添加内容
if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

# 保存后刷新
source ~/.bash_profile
posted @ 2019-06-14 16:22  $wanggang  阅读(3471)  评论(0编辑  收藏  举报