Fancy bash prompt

Git comes with a nice little tool that you can use to make it give info such as the current local branch you are in when in a git repository directory. Here's mine (which also includes various colours):



Prompt when not in a git repository
Prompt when not in a git repository



Prompt-git
Prompt when in a git repository


To achieve this, add the following line to .bashrc:

PS1='\[\e[1;33m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[1;31m\]$(__git_ps1 "(%s)")\[\e[1;33m\]\$ \[\e[m\]\[\e[1;37m\]'