Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save solomonrothman/6754f53354f2dba29905090b9d0775bb to your computer and use it in GitHub Desktop.
Save solomonrothman/6754f53354f2dba29905090b9d0775bb to your computer and use it in GitHub Desktop.
Add git branch to ZSH shell (.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_} > '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment