Skip to content

Instantly share code, notes, and snippets.

@foundry
Created October 26, 2013 13:59
Show Gist options
  • Save foundry/7169773 to your computer and use it in GitHub Desktop.
Save foundry/7169773 to your computer and use it in GitHub Desktop.
bash_profile additions to show your current git branch
:parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
PS1="\[\033[0;31m\]\h:\w\n\u\$(parse_git_branch)>\[\033[0m\] "
@foundry
Copy link
Author

foundry commented Oct 26, 2013

Your PS1 line will differ. You need to insert $(parse_git_branch) before the prompt.

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