Skip to content

Instantly share code, notes, and snippets.

@DimitarChristoff
Created January 26, 2012 08:54
Show Gist options
  • Save DimitarChristoff/1681819 to your computer and use it in GitHub Desktop.
Save DimitarChristoff/1681819 to your computer and use it in GitHub Desktop.
new git prompt
function git_prompt {
local STATUS=`git status 2>&1`
if [[ "$STATUS" != *'Not a git repository'* ]]
then
if [[ "$STATUS" == *'working directory clean'* ]]
then
echo -e "\033[0;32m$(__git_ps1)\033[m"
else
echo -e "\033[0;31m$(__git_ps1)\033[m"
fi
fi
}
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(git_prompt) \$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment