mac git 自動補全

darry發表於2018-08-02

用mac and git 的小夥伴們又沒有發現,mac自帶的git的自動提示補全是否沒有呢,如果要切一個分支名很長怎麼辦?,小編來告訴你!

1.如果沒有安裝HomeBrew的請看下面,安裝了略過

 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安裝過程中要輸入一次密碼

2.安裝bash-completion

brew install bash-completion

#安裝成功後

brew info bash-completion

#回提示Add the following line to your ~/.bash_profile:
#[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
#將這句話cp到.bash_profile 裡面同時 在檔案頭加上source ~/.git-completion.bash

source ~/.bash_profile

3.如果tab鍵測試提示undefined的什麼的,請檢查git版本,我的當前版本為2.18.0

4.如果以上步驟都完成還是不行,請參考 git-completion 檔案

相關文章