OS X, Bash, & Git Autocompletion
A quick tip for developers who solely use Git on the command line in a bash terminal. Add Git branch 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
This will enable you to type git checkout
or git branch
and hit the TAB to have a list of available branches show up. It’s very similar to the built in bash autocomplete for files and folders.
Enjoy!
🧇Read other posts