Skip to content

Instantly share code, notes, and snippets.

@Steve-V
Created November 12, 2011 04:55
Show Gist options
  • Save Steve-V/1360063 to your computer and use it in GitHub Desktop.
Save Steve-V/1360063 to your computer and use it in GitHub Desktop.
Bash prompt to show current checkout
# 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