Wei's Memo

A programmer's log.

Installing Git Autocompletion Script for Mac

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

No need to worry about what directory you’re in when you run this command, it is set to go to your home directory as ~ is used with the target.

Then I added to my ~/.bash_profile file the following ‘execute if it exists’ code:

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