Skip to content

Instantly share code, notes, and snippets.

@shivas
Created November 3, 2012 23:01
Show Gist options
  • Save shivas/4009228 to your computer and use it in GitHub Desktop.
Save shivas/4009228 to your computer and use it in GitHub Desktop.
bash git prompt
# Display unstaged (*) and staged(+) changes
export GIT_PS1_SHOWDIRTYSTATE="1"
# Display whether there are stashed ($) changes
export GIT_PS1_SHOWSTASHSTATE="1"
# Display if there are untracked (%) files
export GIT_PS1_SHOWUNTRACKEDFILES="1"
# Display if we're ahead (>) or behind (<) or diverged (<>) relative
# to upstream
export GIT_PS1_SHOWUPSTREAM="auto"
source /etc/bash_completion.d/git
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$(__git_ps1 " (%s)")$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1 " (%s)")\$ '
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment