zprofile git prompt

Sometimes the simple things are still helpful, attached is my new favourite zsh profile script, it gives a concise and quite helpful prompt.

function git_branch_name()
{
  branch=$(git symbolic-ref HEAD 2> /dev/null | awk 'BEGIN{FS="/"} {print $NF}')
  if [[ $branch == "" ]];
  then
    :
  else
    echo '('$branch')'
  fi
}

setopt prompt_subst

prompt='%2/ $(git_branch_name) > '