2008-11-15

Show git branch

I fonud nice tip to show current git branch like this:

user@group:~/apps/myapp:master$

At your ~/.bashrc change PS1 value to:   

PS1='${debian_chroot:+($debian_chroot)}\u@h:\w$(__git_ps1 ":%s")\$ '

Updated 28.11: I changed git branch indication to a new location (one line):

PS1='${debian_chroot:+($debian_chroot)}\u@\h$(__git_ps1 "[%s]"):\w '

what will produce:

user@group[master]:~/apps/myapp 

Enjoy!

Updated 2009.04.09: Nowadays I'm using zsh :-)