Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@svenfuchs
Created February 18, 2009 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svenfuchs/66380 to your computer and use it in GitHub Desktop.
Save svenfuchs/66380 to your computer and use it in GitHub Desktop.
function __git_dirty {
local dirty RED NO_COLOR
RED="\033[0;31m"
NO_COLOR="\e[0m"
dirty=$(git diff-index --cached --quiet HEAD 2>/dev/null || echo "⚡")
if [ ! -z "$dirty" ]; then
echo "${RED}${dirty}${NO_COLOR}";
return;
fi
dirty=$(git diff-index --quiet HEAD 2>/dev/null || echo "⚡")
[ -z "$dirty" ] && return
echo "${RED}${dirty}${NO_COLOR}";
}
export PS1='\[\033]0;\w\007\]\u:\W$(__git_ps1 "/%s$(__git_dirty)")$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment