Skip to content

Instantly share code, notes, and snippets.

@ademuk
Last active December 11, 2015 21:49
Show Gist options
  • Save ademuk/4665194 to your computer and use it in GitHub Desktop.
Save ademuk/4665194 to your computer and use it in GitHub Desktop.
Adding your current GIT branch to your command prompt.
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
NO_COLOUR="\[\033[0m\]"
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\[\e]0;\u:\w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[01;34m\]:\w\[\033[00m\]$YELLOW\$(parse_git_branch)$NO_COLOUR\$"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment