How to Change Your BASH Prompt for Git

This is what I use on my Ubuntu machine. It adds my Git username, email, and branch to my Bash prompt.

show_git_branch() {
	# 27(decimal) === 1b(hex) === 033(octal);
	# \x1b \[ 36 m === \[ \e [ 0;36 m \] || \e [ 0;36 m
	git_user=$(git config --list | grep -iPo "(?<=user.name=).*")
	git_email=$(git config --list | grep -iPo "(?<=user.email=).*")
	git branch 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/ \x1b\[36mgit:\x1b\m(\x1b\[31m$git_user;$git_email;\1\x1b\[m\x1b\[36m)\x1b\[m /"
}

export PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$(show_git_branch)\$ "