git mac autocomplete

imflorachen
1 min readAug 10, 2020

用 mac terminal 下 git 指令時並不會自動補全,需要另外設定。

步驟 1 :直接於 terminal 輸入指令

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

步驟 2 : 開啟 ~/.bash_profile,若無此檔案就新增一個

vi .bash_profile

輸入 a 即可 insert,貼上下列指令,再 esc 最後 :wq 儲存

[[ -f "$HOME/.git-completion.bash" ]] && source "$HOME/.git-completion.bash"

步驟 3 : 重新讀取 bash_profile

source ~/.bash_profile

完成!

--

--

imflorachen

Hi i’m trying to write what i’ve learned from work or from books. Wish I could become a better data scientist.