使用git sta命令的时候,tab补全键按裂了都没反应,一般的linux系统下都会自动补全的,而mac并不会
好吧,百度了一下
1, 先安装bash-completion
brew install bash-completion
安装完成后
brew info bash-completion
提示
Add the following line to your ~/.bash_profile:
[[ -r “/usr/local/etc/profile.d/bash_completion.sh” ]] && . “/usr/local/etc/profile.d/bash_completion.sh”
按要求把[[ -r “/usr/local/etc/profile.d/bash_completion.sh” ]] && . “/usr/local/etc/profile.d/bash_completion.sh”丢到.bash_profile里面
然后source ~/.bash_profile生效
2,安装git-completion
访问https://github.com/git/git/tree/master/contrib/completion
拷贝git-completion.bash文件内容(如果用的zsh就复制zsh的),保存到~/.bash-completion.bash
然后 echo ‘source ~/.bash-completion.bash’ >> ~/.base_profile
source ~/.base_profile 生效
ok,使用git时,就能按tab自动补全命令了