Clone this wiki locally
I borrowed this code from the zshkit project. Just drop it into your
~/.zshrc file. It adds the current branch name to the
zsh prompt, so that I know at a glance what branch I’m on when I’m in a directory with a branch. It also changes the color of the branch name from cyan to magenta depending on whether or not there are any local changes. Very handy if you’re used to working in a directory named for a Subversion branch.
Bash users, check out this guide for essentially the same hack.