Skip to content

Instantly share code, notes, and snippets.

@armed
Created April 5, 2011 03:37
Show Gist options
  • Save armed/902974 to your computer and use it in GitHub Desktop.
Save armed/902974 to your computer and use it in GitHub Desktop.
show git branch and dirty state in bash
# ANSI color codes
RS="\[\033[0m\]" # reset
HC="\[\033[1m\]" # hicolor
UL="\[\033[4m\]" # underline
INV="\[\033[7m\]" # inverse background and foreground
FBLK="\[\033[30m\]" # foreground black
FRED="\[\033[31m\]" # foreground red
FGRN="\[\033[32m\]" # foreground green
FYEL="\[\033[33m\]" # foreground yellow
FBLE="\[\033[34m\]" # foreground blue
FMAG="\[\033[35m\]" # foreground magenta
FCYN="\[\033[36m\]" # foreground cyan
FWHT="\[\033[37m\]" # foreground white
export GIT_PS1_SHOWDIRTYSTATE=1
PS1="$HC$FYEL[ $FGRN${debian_chroot:+($debian_chroot)}\u$FYEL: $FMAG\w$FCYN"'$(__git_ps1 " (%s)")'"$FYEL]\n\\$ $RS"
PS2="$HC$FYEL> $RS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment