Salty Bits

home

Git Tip: Enable Branch Autocompletion

12 Mar 2014

Not sure how I didn't come across this earlier but it's a god send. Way easier to use long descriptive branch names once autocomplete is enabled!

Step 1) Download git-completion.bash from the git repo

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

Step 2) Add it to your .bash_profile

# ~/.bash_profile
if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

Open up a new terminal window or source ~/.bash_profile and you're good to go!