Skip to content

Instantly share code, notes, and snippets.

@todb
Created April 30, 2012 02:50
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save todb/2555109 to your computer and use it in GitHub Desktop.
Save todb/2555109 to your computer and use it in GitHub Desktop.
Stick this in your bashrc and don't wonder what branch/ruby/gemset you're using
# Git and RVM prompting
function git-current-branch {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /'
}
export PS1="[\$(~/.rvm/bin/rvm-prompt v p g)] \$(git-current-branch)$PS1"
@wvu
Copy link

wvu commented Aug 29, 2014

You could use git branch 2> /dev/null | sed -n 's/^\* //p' and put the parens in your $PS1. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment