-
-
Save duff/52913 to your computer and use it in GitHub Desktop.
Git branch and dirty state (using git-completion.bash) and colored
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# [ ~/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