Skip to content

Instantly share code, notes, and snippets.

@leehambley
Created March 16, 2009 18:22
Show Gist options
  • Save leehambley/79984 to your computer and use it in GitHub Desktop.
Save leehambley/79984 to your computer and use it in GitHub Desktop.
# From the GitHub guide
parse_git_branch() {
branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'`
if [ "$branch" = "(master)" ] ; then
branch="$(tput setaf 1)${branch}$(tput sgr0)"
elif [ "$branch" != '' ] ; then
branch="${branch}"
fi
echo $branch
}
# Pretty Prompt...
# http://thinkingdigitally.com/archive/sweet-black-terminal-theme-for-osx-leopard/
export PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W\n \$ $(parse_git_branch)\[\033[00m\]→ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment