Git Branch in ZSH Prompt?

Use the vcs_info function in the zsh user contributions (included in the zsh package). Quick start:

autoload -Uz vcs_info
precmd () { vcs_info }
setopt prompt_subst
PS1="\$vcs_info_msg_0_$PS1"

It's likely that you'll want to make the output prettier. Since that's matter of personal taste, I refer you to the examples in the documentation.


Use oh-my-zsh. It is an auto-updating collection of several dozen plugins and themes that make zsh even better than it is already. Assuming that you have git installed already, it will automatically activate the git plugin, and then you're ready to go!