Automatic completion of git commands under mac

get script

curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash

Add to ~/.bash_profile

if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

Add execute permission

chmod -x ~/.git-completion.bash 

Compile the file
source ~/.git-completion.bash

details as follows:

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$ 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324649391&siteId=291194637