Install Git Completion:
Save the git-completion.bash file in your home directory:
Installation
Open your .bash_profile
nano ~/.bash_profile
Paste the following at the top of the file, make sure not to overwrite any other settings you may have put in the file.
###### GIT COMPLETION - START ###### parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/' } # Colour Variables BLACK="\[\033[0;30m\]" BLACKBOLD="\[\033[1;30m\]" RED="\[\033[0;31m\]" REDBOLD="\[\033[1;31m\]" GREEN="\[\033[0;32m\]" GREENBOLD="\[\033[1;32m\]" YELLOW="\[\033[0;33m\]" YELLOWBOLD="\[\033[1;33m\]" BLUE="\[\033[0;34m\]" BLUEBOLD="\[\033[1;34m\]" PURPLE="\[\033[0;35m\]" PURPLEBOLD="\[\033[1;35m\]" CYAN="\[\033[0;36m\]" CYANBOLD="\[\033[1;36m\]" WHITE="\[\033[0;37m\]" WHITEBOLD="\[\033[1;37m\]" RESETCOLOR="\[\e[00m\]" LIME_YELLOW=$(tput setaf 190) POWDER_BLUE=$(tput setaf 153) # Define the terminal output string: username in path - branch export PS1="${REDBOLD}\u ${RESETCOLOR}in ${CYANBOLD}\w ${GREEN}-\$(parse_git_branch)${RESETCOLOR} $ " # Include the git completion file (must be saved in your home directory for this to work) # Source: https://github.com/git/git/blob/master/contrib/completion/git-completion.bash if [ -f ~/.git-completion.bash ]; then . ~/.git-completion.bash # Add git completion to aliases __git_complete gco _git_checkout __git_complete gb _git_branch __git_complete gc _git_commit fi ###### GIT COMPLETION - END ######
Reload .bash_profile
source ~/.bash_profile