Skip to content

Instantly share code, notes, and snippets.

@davidbalbert
Created February 25, 2011 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidbalbert/843504 to your computer and use it in GitHub Desktop.
Save davidbalbert/843504 to your computer and use it in GitHub Desktop.
show branch name in your prompt
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \[\1\]/'
}
# path prompt
export PS1="\h:\w\$(parse_git_branch)\$ "
# make bash use vi mode. You are by default in "insert" mode, so you have to hit escape to get to the commands
set -o vi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment