git.zsh 433 Bytes
Newer Older
1
2
# get the name of the branch we are on
function git_prompt_info() {
Christopher Sexton's avatar
Christopher Sexton committed
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

7
parse_git_dirty () {
8
9
10
11
12
  if [[ $(git status  | tail -n1) != "nothing to commit (working directory clean)" ]]; then
    echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
  else
    echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
  fi
13
}
14