Skip to content

Instantly share code, notes, and snippets.

@sanghapark
Created February 20, 2017 02:35
Show Gist options
  • Save sanghapark/532d274e5d1e29b12804b9ed072a6335 to your computer and use it in GitHub Desktop.
Save sanghapark/532d274e5d1e29b12804b9ed072a6335 to your computer and use it in GitHub Desktop.
Git Branch Name to Terminal Prompt with Coloring
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\e[91m\]\$(parse_git_branch)\[\033[00m\] $ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment