Skip to content

Instantly share code, notes, and snippets.

@tmcgee123
Last active February 9, 2016 15:23
Show Gist options
  • Save tmcgee123/a0cdc3e67c808d9642bc to your computer and use it in GitHub Desktop.
Save tmcgee123/a0cdc3e67c808d9642bc to your computer and use it in GitHub Desktop.
This is to show the current Git branch that you are on while inside of Terminal.
#Found this here: http://martinfitzpatrick.name/article/add-git-branch-name-to-terminal-prompt-mac/
#Add this to your .bash_profile for Mac, haven't tested on Linux but it would go in .bashrrc there
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment