Skip to content

Instantly share code, notes, and snippets.

Created January 1, 2013 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4429365 to your computer and use it in GitHub Desktop.
Save anonymous/4429365 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 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
function show_colored_git_branch_in_prompt() {
PS1='\[\033[01;37m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\]$(parse_git_branch) '
}
show_colored_git_branch_in_prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment