Skip to content

Instantly share code, notes, and snippets.

@duff
Forked from henrik/.bashrc
Created January 26, 2009 18:53
Show Gist options
  • Save duff/52913 to your computer and use it in GitHub Desktop.
Save duff/52913 to your computer and use it in GitHub Desktop.
Git branch and dirty state (using git-completion.bash) and colored
# [ ~/develop/dir ] master $ # clean working directory
# [ ~/develop/dir ] master* $ # dirty working directory
# [ ~/some_dir ] $ # not a git repo
source ~/bin/.git-completion.sh # Copied the contrib/completion/git-completion.bash file in the git distribution
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
PS1='\e[0m[ \e[32m\w\e[0m ]$(__git_ps1 " \e[33m%s\e[31m$(parse_git_dirty)\e[0m") $ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment