duff (owner)

Fork Of

gist: 31631 by henrik Git branch and dirty state ...

Revisions

gist: 52913 Download_button fork
public
Description:
Git branch and dirty state (using git-completion.bash) and colored
Public Clone URL: git://gist.github.com/52913.git
Embed All Files: show embed
.bashrc #
1
2
3
4
5
6
7
8
9
10
11
12
# [ ~/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") $ '