$ vi ~/.zshrc
# Load version control information
autoload -Uz vcs_info
precmd() { vcs_info }
# Format the vcs_info_msg_0_ variable
zstyle ':vcs_info:git:*' formats 'on branch %b'
# Set up the prompt (with git branch name)
setopt PROMPT_SUBST
PROMPT='%n in ${PWD/#$HOME/~} ${vcs_info_msg_0_} > '
- Add Git branch
https://github.com/ohmyzsh/ohmyzsh
And using Oh My Zsh is an open source, community-driven framework for managing your zsh configuration.
Installation
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Add plugins and use plugins
$ vi ~/.zshrc
plugins=(
git
bundler
dotenv
osx
rake
rbenv
ruby
)
ZSH_THEME="agnoster" # (this is one of the fancy ones)
# see https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster