Skip to content

Instantly share code, notes, and snippets.

@Kris-Simpson
Forked from Surzhko/.bash_profile
Last active April 9, 2019 14:01
Show Gist options
  • Save Kris-Simpson/ab274db3ca7f5160d5ad4bbba3517547 to your computer and use it in GitHub Desktop.
Save Kris-Simpson/ab274db3ca7f5160d5ad4bbba3517547 to your computer and use it in GitHub Desktop.
colorized git ps1
#...
source ~/.git-prompt.sh
__git_color_ps1 ()
{
if [ -n "$(__git_ps1)" ]; then
local IS_CLEAN=`git status | grep -i "working .* clean"`;
if [ -z "$IS_CLEAN" ]; then
echo -e "\e[1;31m"
else
echo -e "\e[1;37m"
fi
fi
}
#PS1="\u@\h:\w\[\$(__git_color_ps1)\]\$(__git_ps1)\[\e[0m\]\$ "
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\$(__git_color_ps1)\]\$(__git_ps1)\[\e[0m\]\$ "
#....
#http://stackoverflow.com/questions/12870928/mac-bash-git-ps1-command-not-found
curl -o ~/.git-prompt.sh https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment