Skip to content

Instantly share code, notes, and snippets.

@kamermans
Last active December 26, 2015 03:59
Show Gist options
  • Select an option

  • Save kamermans/7089627 to your computer and use it in GitHub Desktop.

Select an option

Save kamermans/7089627 to your computer and use it in GitHub Desktop.
Script that adds git status to the bash prompt.
# Git integration
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
# You should edit ~/.bashrc and set `force_color_prompt=yes`, then add
# this this to the end: if [ -f ~/.bash_git ]; then . ~/.bash_git; fi
LIGHT_WHITE="\[\033[1;37m\]"
WHITE="\[\033[0;37m\]"
GRAY="\[\033[1;30m\]"
BLACK="\[\033[0;30m\]"
RED="\[\033[0;31m\]"
LIGHT_RED="\[\033[1;31m\]"
GREEN="\[\033[0;32m\]"
LIGHT_GREEN="\[\033[1;32m\]"
YELLOW="\[\033[0;33m\]"
LIGHT_YELLOW="\[\033[1;33m\]"
BLUE="\[\033[0;34m\]"
LIGHT_BLUE="\[\033[1;34m\]"
MAGENTA="\[\033[0;35m\]"
LIGHT_MAGENTA="\[\033[1;35m\]"
CYAN="\[\033[0;36m\]"
LIGHT_CYAN="\[\033[1;36m\]"
ORANGE="\[\033[38;5;172m\]"
COLOR_NONE="\[\033[00m\]"
if [ -f ~/.git-prompt.sh ]; then
# Load in the git branch prompt script.
source ~/.git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=true
# GIT_PS1_SHOWSTASHSTATE=true
# GIT_PS1_SHOWUNTRACKEDFILES=true
GIT_PS1_SHOWUPSTREAM=auto
# GIT_PS1_SHOWCOLORHINTS=true
# Customize prompt for git
PS1="${debian_chroot:+($debian_chroot)}$LIGHT_GREEN\u@\h$COLOR_NONE:$LIGHT_BLUE\w$ORANGE\$(__git_ps1)$COLOR_NONE\$ "
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment