Skip to content

Instantly share code, notes, and snippets.

@kirillzubovsky
Created June 27, 2013 06:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirillzubovsky/5874367 to your computer and use it in GitHub Desktop.
Save kirillzubovsky/5874367 to your computer and use it in GitHub Desktop.
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
CYN='\e[1;96m'
# git dirty branch
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "(._.)"
}
function parse_git_clean {
[[ $(git status 2> /dev/null | tail -n1) == "nothing to commit (working directory clean)" ]] && echo "(>_<)"
}
# branch in PS
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
PS1="$RED\$(date +%H:%M) \w$YELLOW \$(parse_git_branch) $CYN\$(parse_git_dirty)\$(parse_git_clean)$GREEN$\[\e[0m\] "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment