Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Show git branch in bash prompt
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1='\h:\W \u$(parse_git_branch)\$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment