Mac平台下git命令自动补全
一、安装bash-completion
- 安装Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- 安装bash-completion
brew install bash-completion
- 根据
bash-completion
安装完成后提示,将[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
加入~/.bash_profile
二、下载git-completion.bash文件
-
拷贝该页面代码到本地
~/.git-completion.bash
-
将
source ~/.git-completion.bash
加入~/.bash_profile
-
执行
source
~/.bash_profile