First install HomeBrew and then use brew to install the bash-completion package
brew install bash-completion
After that you can open up your ~/.bashrc
file and add the following:
# Load git prompt that display current branch etc
source /usr/local/etc/bash_completion.d/git-prompt.sh
# Define a nice prompt with git prompt inside it
PS1='\[\033[1;34m\]\w\[\033[0;35m\]$(__git_ps1 " (%s)") \[\033[1;36m\]$ \[\033[0m\]'
# Enable bash completion via brew install bash-completion
# It will load all completions defined in /usr/local/etc/bash_completion.d/
if [ -f $(brew --prefix)/etc/bash_completion ]; then
source $(brew --prefix)/etc/bash_completion
fi
Open up a new terminal Cmd+n
and it should be working.