Skip to content

Instantly share code, notes, and snippets.

@johnjohndoe
Created December 1, 2010 10:27
Show Gist options
  • Save johnjohndoe/723302 to your computer and use it in GitHub Desktop.
Save johnjohndoe/723302 to your computer and use it in GitHub Desktop.
Colored bash prompt showing git branch (.bash_rc)
# Set git tab completion and PS1 integration
if [ -f /usr/local/git/contrib/completion/git-completion.bash ]; then
. /usr/local/git/contrib/completion/git-completion.bash
fi
GIT_PS1_SHOWDIRTYSTATE=true
if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
fi
# Colored bash prompt showing git branch and current state.
BROWN='\[\033[33m\]'
GREEN='\[\033[32m\]'
RED='\[\033[31m\]'
WHITE='\[\033[00m\]'
PS1=$WHITE'['$BROWN'\W'$GREEN'$(__git_ps1)'$WHITE']\$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment