Skip to content

Instantly share code, notes, and snippets.

@vkurup
Created May 7, 2014 15:27
Show Gist options
  • Save vkurup/00c660135278f307e5d4 to your computer and use it in GitHub Desktop.
Save vkurup/00c660135278f307e5d4 to your computer and use it in GitHub Desktop.
show git branch on command line
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1="\u@\h:\w\$(parse_git_branch) $ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment