Mac系统实现git命令补全

1、先安装brew,安装过的可以忽略
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2、安装bash-completion
brew install bash-completion

3、系统配置

下载此文件
https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
然后复制到家目录
cp xxx/git-completion.bash ~/.git-completion.bash

vim ~/.bash_profile 加入以下代码
if [ -f ~/.git-completion.bash ]; then
   . ~/.git-completion.bash
fi

读取文件
source ~/.git-completion.bash

分类:   服务器笔记  / 
标签:   git
 /  浏览量:  630
2020-10-12 14:34 Monday