How to Display your Local Git Branch in your BASH prompt
In order to make your life easier when working with git, this article provides the steps to display the current local git branch within your bash prompt. This not only saves you time, but also prevents the potential for human error by ensuring you are not making changes to the wrong branch.
First all we download the git prompt script.
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -o ~/.git-prompt.sh
We then add the following lines to ~/.bashrc.
# import script
# customize/colorize prompt
export PS1="\e[37m\t\e[37m-\e[97m\u\e[92m\e[92m\w\[\033[m\]\e[96m\$(__git_ps1)\e[97m\$ "