git.zsh 390 B

12345678910111213
  1. # get the name of the branch we are on
  2. function git_prompt_info() {
  3. ref=$(git symbolic-ref HEAD 2> /dev/null) || return
  4. echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
  5. }
  6. parse_git_dirty () {
  7. if [[ -n $(git status -s 2> /dev/null) ]]; then
  8. echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
  9. else
  10. echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
  11. fi
  12. }