Get the git-promt.sh script here. Put it somewhere like ~/.git-prompt.sh. If you want to be all CLI about it, you could just run:
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -o ~/.git-prompt.shNow modify your your bash profile (it’s at ~/.bash-profile, in case you’re new to this stuff). Before the part of the file that declares what your prompt will look like (PS1=[...]), load in the script you just downloaded, like so:
# Load in the git branch prompt script.