思路:獲取補全腳本。放入~/.brash 中加載
- 下載git-completion.bash 並放到home 目錄下:
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
- 將如下行放到
.bash_profile
文件中
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi 將其立即生效:
source ~/.bash_profile
==================================
找到git-completion.bash
# 得到git completion腳本,拷貝一份放到自己的位置
find / -name git-completion.bash
# 將腳本加入用戶bash環境變量
vim ~/.bashrc
# 填入內容並保存
. PATH_TO_git-completion.bash
# 使配置生效,而不用重啓或者重新登錄
source ~/.bashrc
==================================