mac下git命令自動補全

獲取腳本

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

添加執行權限

chmod -x ~/.git-completion.bash 

編譯文件
source ~/.git-completion.bash

具體如下:

zhaojunyandeMBP:goproject zhaojunyan$ curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 69413  100 69413    0     0  18360      0  0:00:03  0:00:03 --:--:-- 18358
zhaojunyandeMBP:goproject zhaojunyan$ 
zhaojunyandeMBP:goproject zhaojunyan$ vim ~/.bash_profile  
zhaojunyandeMBP:goproject zhaojunyan$ chmod -x ~/.git-completion.bash 
zhaojunyandeMBP:goproject zhaojunyan$ source ~/.git
.git-completion.bash  .gitconfig            
zhaojunyandeMBP:goproject zhaojunyan$ source ~/.git-completion.bash 
zhaojunyandeMBP:goproject zhaojunyan$ git branch 
  develop
  master
* uat
zhaojunyandeMBP:goproject zhaojunyan$ 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章