Source: https://davidwalsh.name/git-branch-autocompletion
Start by downloading the git-completion.sh file from GitHub:
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
Next, add the following to your ~/.bash_profile
file:
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
The last step is restarting your terminal. Voila! Now you can type git checkout {search-string}
and
press tab to select the lone branch that matches or hit tab again to see all matches!