Skip to content

Instantly share code, notes, and snippets.

@johnmdonahue
Created February 17, 2012 20:58
Show Gist options
  • Save johnmdonahue/1855410 to your computer and use it in GitHub Desktop.
Save johnmdonahue/1855410 to your computer and use it in GitHub Desktop.
PS1 git_branch w/o git_completion
function git_branch_name {
val=`git branch 2>/dev/null | grep '^*' | colrm 1 2`
echo "$val"
}
function parse_git_branch {
val=`git_branch_name | sed 's_\(.*\)_(\1)_'`
echo "$val"
}
if [ "$color_prompt" = yes ]; then
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \[\033[0;33m\]\$(parse_git_branch) \$\[\033[00m\] "
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w $(parse_git_branch) \$ '
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment