Skip to content

Instantly share code, notes, and snippets.

@lantrix
Forked from tekkub/.bashrc
Created November 27, 2009 06:28
Show Gist options
  • Save lantrix/243856 to your computer and use it in GitHub Desktop.
Save lantrix/243856 to your computer and use it in GitHub Desktop.
Git branch name in Bash Prompt showing user@host:path(git_branch) - for xterm-color
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$(parse_git_branch) "
case `id -u` in
0) PS1="${PS1}# ";;
*) PS1="${PS1}$ ";;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment