Skip to content

Instantly share code, notes, and snippets.

@kevinchappell
Created July 2, 2015 21:40
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kevinchappell/09ca3805a9531b818579 to your computer and use it in GitHub Desktop.
Save kevinchappell/09ca3805a9531b818579 to your computer and use it in GitHub Desktop.
parse_git_branch() in terminal
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1='${debian_chroot:+($debian_chroot)}\[\033[1;31m\]\u\[\033[1;37m\]@\[\033[1;32m\]\h\[\033[1;37m\]:\[\033[1;36m\]\w \[\033[1;35m\]$(parse_git_branch) \[\033[1;33m\]\$ \[\033[0m\]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment