Skip to content

Instantly share code, notes, and snippets.

@damoncali
Last active August 29, 2015 13:57
Show Gist options
  • Save damoncali/9784257 to your computer and use it in GitHub Desktop.
Save damoncali/9784257 to your computer and use it in GitHub Desktop.
Fancy Git Prompt for OSX
#credit goes to Xavier Shay for this one: http://xaviershay.com/
#put this in ~/.bash_login, then reload with . ~/.bash_login
#fancy git prompt
function parse_git_dirty {
git diff --quiet 2> /dev/null || echo " *"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/(\1$(parse_git_dirty))/"
}
# actual prompt
export PS1='\[\033[36;40m\] \@ \u@\h: \w\[\033[34;40m\]$(parse_git_branch)\[\033[36;40m\]>\[\033[0m\]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment