Skip to content

Instantly share code, notes, and snippets.

@foresmac
Created March 27, 2013 20:58
Show Gist options
  • Select an option

  • Save foresmac/5257946 to your computer and use it in GitHub Desktop.

Select an option

Save foresmac/5257946 to your computer and use it in GitHub Desktop.
Shows current working git branch in you bash prompt.
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /'
}
PS1="\[\e[32m\]\$(parse_git_branch)\[\e[34m\]\h:\W \$ \[\e[m\]"
export PS1
@foresmac
Copy link
Copy Markdown
Author

Found in this excellent tutorial for using git by David Winterbottom.

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