mac代码自动补全git上

# 1. 安装bash-completion

$ brew install bash-completion

卸载使用$brew uninstall bash-completion

$ brew tap homebrew/completions

 

 

# 2. 在用户目录.bash_profile添加如下脚本

if [ -f $(brew –prefix)/etc/bash_completion ]; then

. $(brew –prefix)/etc/bash_completion

fi

# 3. 增加Git命令补全

```

cd/usr/local/opt/bashcompletion/etc/bashcompletion.dcd/usr/local/opt/bash−completion/etc/bashcompletion.d curl -L -O https://raw.github.com/git/git/master/contrib/completion/git-completion.bash 
brewunlinkbashcompletionbrewunlinkbash−completion brew link bash-completion

```

# 4. 以上步骤做完,即可实现git命令参数补全功能

$ git chec # 按tab键补全参数

$ git checkout dev #假如有分支名为dev-master,tab键之后会自动补全分支名

posted @ 2018-12-15 19:52  James_gao  阅读(377)  评论(0编辑  收藏  举报