Git Branch in bash prompt

Git Branch in bash prompt
27. Mar 2012
1 minute read

My Bash prompt is something like this archimedes:toke.de(master) toke$. Where archimedes is the hostname, toke.de the directory within an git checkout, master the actual branch and toke my username. To get this result set this PS1 in your .bashrc:

## Add Git-Branch
PS1='\h:\W$(__git_ps1 "(%s)") \u\$ '


Back to posts