Open ~/.bashrc
in your favorite editor and add the following content to the bottom.
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Linux
export PS1="\e[1m\e[32m\u@\h\e[0m\e[0m:\e[1m\e[34m\w\e[0m\e[1;33m\$(parse_git_branch)\e[0m\$ "
# MacOS
export PSQ="\[\033[34m\]\\u@\h\[\033[00m\]:\W\[\033[32m\]\$(parse_git_branch)\[\033[00m\]$ "