Skip to content

Instantly share code, notes, and snippets.

@mpangrazzi
Created January 25, 2014 10:11
Show Gist options
  • Save mpangrazzi/8614322 to your computer and use it in GitHub Desktop.
Save mpangrazzi/8614322 to your computer and use it in GitHub Desktop.
Clean PS1 (with current git branch displayed)
#
# This is a simple, clean PS1 with current git branch displayed.
# How will look like:
#
# λ ~/home/project (master)
#
# NOTE: You may have to configure your terminal to support UTF-8 Unicode (so λ will displayed correctly)
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
WHITE="\[\033[1;37m\]"
YELLOW="\[\033[1;33m\]"
NO_COLOUR="\[\033[0m\]"
GREEN="\[\033[1;32m\]"
PS1="\[\033[1;37m\]λ $GREEN\w$YELLOW\$(parse_git_branch)$NO_COLOUR "
@boycce
Copy link

boycce commented May 10, 2018

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment