请参照以下步骤##
- 1.查看是否已经安装了
bash-completion
,如果没有请使用以下命令安装brew install bash-completion
- 2.执行
brew info bash-completion
命令
$brew info bash-completion
Add the following lines to your ~/.bash_profile:
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
- 3.将第二步中的if..then...fi语句添加到
~/.bash_profile
文件中(如果没有该文件,新建一个) - 4.重启终端
以上为安装bash-completion部分###
- 5.将Git源码clone到本地
$ git clone https://github.com/git/git.git
小提示:如果不希望clone整个项目,可以直接将项目中的contrib/completion/git-completion.b