Install Git completion on Mac OSX
If you're like me and use the command line for everything Git, then you are missing the autocompletion when on a Mac. So, if you are using zsh, and you should, it's super simple, just install ohmyzsh:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Otherwise, if you are still using bash (goodie but oldie), then let's add autocompletion via Homebrew:
brew install bash-completion
Then add the following to ~/.bash_profile
if [ -f `brew --prefix`/etc/bash_completion.d/git-completion.bash ]; then
. `brew --prefix`/etc/bash_completion.d/git-completion.bash
fi
Restart your terminal and try to type git checkout or git branch, then hit the TAB to have a list of available branches. It’s very similar to the built in bash autocomplete for files and folders.