SW Designs

Technology and Photography

Git Completion With Mac OS X

On every fresh OS X install, I always end-up googling how-to setup Git completion on the command line. Almost every article I read suggests cloning the Git source code to acquire the necessary bash script. That’s not necessary if you have the offical Git package installed as you’ll already have the file under /usr/local/git/.

To add it to your bash profile,

echo 'source /usr/local/git/contrib/completion/git-completion.bash' >> ~/.bash_profile

While you’re there you can load /usr/local/git/contrib/completion/git-promot.bash too. Instructions for setting PS1 are in the file.