Created
September 14, 2015 21:51
-
-
Save pestophagous/245d6c3178c7f88c7a70 to your computer and use it in GitHub Desktop.
put in bash .profile to see git branch name as part of PS1 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
# write a function to compute the current git branch | |
parse_git_branch() { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} # why is the ending with the > and the extra space not working?? | |
# set the PS1 variable | |
PS1="$PS1\[\e[0;33;34m\]\$(parse_git_branch)\[\e[0;0m\]" | |
#local BLUE="\[\033[0;34m\]" | |
#local RED="\[\033[0;31m\]" | |
#local LIGHT_RED="\[\033[1;31m\]" | |
#local GREEN="\[\033[0;32m\]" | |
#local LIGHT_GREEN="\[\033[1;32m\]" | |
#local WHITE="\[\033[1;37m\]" | |
#local RESTORE="\[\033[0;0m\]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment