Skip to content

Instantly share code, notes, and snippets.

@nobuti
Created August 28, 2012 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nobuti/3496483 to your computer and use it in GitHub Desktop.
Save nobuti/3496483 to your computer and use it in GitHub Desktop.
Bash profile
# enable git unstaged indicators - set to a non-empty value
GIT_PS1_SHOWDIRTYSTATE="."
# enable showing of untracked files - set to a non-empty value
GIT_PS1_SHOWUNTRACKEDFILES="."
# enable stash checking - set to a non-empty value
GIT_PS1_SHOWSTASHSTATE="."
# enable showing of HEAD vs its upstream
GIT_PS1_SHOWUPSTREAM="auto"
BLACK=$(tput setaf 0)
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
LIME_YELLOW=$(tput setaf 190)
POWDER_BLUE=$(tput setaf 153)
BLUE=$(tput setaf 4)
MAGENTA=$(tput setaf 5)
CYAN=$(tput setaf 6)
WHITE=$(tput setaf 7)
BRIGHT=$(tput bold)
NORMAL=$(tput sgr0)
BLINK=$(tput blink)
REVERSE=$(tput smso)
UNDERLINE=$(tput smul)
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
# return the prompt prefix for the second line
function set_prefix {
BRANCH=`__git_ps1`
if [[ -z $BRANCH ]]; then
echo "${NORMAL}o"
else
echo "${UNDERLINE}+"
fi
}
PS1='\n\[\033[0;35m\]\u \[\033[0;32m\]\w\[\033[0m\] $(parse_git_branch)\n\$\[\033[0m\] '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment