mac git 自动补全

用mac and git 的小伙伴们又没有发现,mac自带的git的自动提示补全是否没有呢,若是要切一个分支名很长怎么办?,小编来告诉你!git

1.若是没有安装HomeBrew的请看下面,安装了略过github

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装过程当中要输入一次密码ruby

2.安装bash-completionbash

brew install bash-completion

#安装成功后

brew info bash-completion

#回提示Add the following line to your ~/.bash_profile:
#[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
#将这句话cp到.bash_profile 里面同时 在文件头加上source ~/.git-completion.bash

source ~/.bash_profile

3.若是tab键测试提示undefined的什么的,请检查git版本,个人当前版本为2.18.0curl

4.若是以上步骤都完成仍是不行,请参考 git-completion 文件测试

相关文章
相关标签/搜索