Skip to content

Instantly share code, notes, and snippets.

@jpemberthy
Created October 18, 2014 01:20
Show Gist options
  • Save jpemberthy/46ad36c546dc703d2c36 to your computer and use it in GitHub Desktop.
Save jpemberthy/46ad36c546dc703d2c36 to your computer and use it in GitHub Desktop.
PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$(parse_git_branch)$\[\033[00m\] "
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)]/"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment