Skip to content

Instantly share code, notes, and snippets.

@tylerpearson
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save tylerpearson/c71b55f44484d80d8f53 to your computer and use it in GitHub Desktop.

Select an option

Save tylerpearson/c71b55f44484d80d8f53 to your computer and use it in GitHub Desktop.
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
export PS1='\[\033[34;40m\]\W \[\033[0;33m\]$(parse_git_branch)\[\e[0m\] $ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment