Created
February 21, 2013 20:16
-
-
Save st3v/5007830 to your computer and use it in GitHub Desktop.
Show git branch in prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mac git bash completion | |
source /usr/local/git/contrib/completion/git-completion.bash | |
# lucid git bash completion | |
# source /etc/bash_completion.d/git-completion.bash | |
GIT_PS1_SHOWDIRTYSTATE="." | |
GIT_PS1_SHOWUNTRACKEDFILES="." | |
GIT_PS1_SHOWSTASHSTATE="." | |
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 set_prefix { | |
BRANCH=`__git_ps1` | |
if [[ -z $BRANCH ]]; then | |
echo "${NORMAL}$" | |
else | |
echo "${UNDERLINE}+" | |
fi | |
} | |
export TERM=xterm-color | |
PS1='\[${RED}\u@${RED}\h${WHITE} in ${GREEN}\w${WHITE}`__git_ps1 " on ${YELLOW}%s"`${WHITE}\r\n\]\[`set_prefix`\]\[${NORMAL}${WHITE}\] ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment