Skip to content

Instantly share code, notes, and snippets.

@EvanBurchard
Created November 30, 2015 22:17
Show Gist options
  • Save EvanBurchard/3c4d89d72724768eafba to your computer and use it in GitHub Desktop.
Save EvanBurchard/3c4d89d72724768eafba to your computer and use it in GitHub Desktop.
function parse_git_dirty {
if [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]]
then
echo "\e[0;31m"
else
echo "\e[0;00m"
fi
}
PS1='\w$(__git_ps1 " (\[$(parse_git_dirty)\]%s\[\e[m\])") \$ '
export PS1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment