Skip to content

Instantly share code, notes, and snippets.

@simonlynen
Last active January 29, 2016 11:00
Show Gist options
  • Save simonlynen/5482581 to your computer and use it in GitHub Desktop.
Save simonlynen/5482581 to your computer and use it in GitHub Desktop.
git color and show branch
git config --global color.ui "auto"
__git_ps1 ()
{
local b="$(git symbolic-ref HEAD 2>/dev/null)";
if [ -n "$b" ]; then
printf " (%s)" "${b##refs/heads/}";
fi
}
export GIT_PS1_SHOWDIRTYSTATE=1
export PS1='\[\033[03;32m\]\u@\h\[\033[01;34m\]:\w\[\033[02;33m\]$(__git_ps1)\[\033[01;34m\]\$\[\033[00m\] '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment