Created
November 12, 2011 04:55
-
-
Save Steve-V/1360063 to your computer and use it in GitHub Desktop.
Bash prompt to show current checkout
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
# Change prompt to display current git branch | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/:\1/' | |
} | |
PS1="[\u@\h \W\$(parse_git_branch)]" | |
case `id -u` in | |
0) PS1="${PS1}# ";; | |
*) PS1="${PS1}$ ";; | |
esac | |
# end git branch code |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment