Created
January 25, 2016 18:20
-
-
Save mariorez/cefe4c0f74e45e824364 to your computer and use it in GitHub Desktop.
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
| ### GIT DIRTY | |
| source /usr/share/git/completion/git-prompt.sh | |
| function _git_prompt() { | |
| local git_status="`git status -unormal 2>&1`" | |
| if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then | |
| if [[ "$git_status" =~ nothing\ to\ commit ]]; then | |
| local signal='\[\e[0;1;32m\] ✔\[\e[0m\]' | |
| elif [[ "$git_status" =~ nothing\ added\ to\ commit\ but\ untracked\ files\ present ]]; then | |
| local signal='\[\e[0;1;31m\] ✘\[\e[0m\]' | |
| else | |
| local signal='\[\e[0;1;31m\] ✘\[\e[0m\]' | |
| fi | |
| echo -n '\[\e[0;33;33m\]'"$(__git_ps1)$signal"'\[\e[0m\]' | |
| fi | |
| } | |
| function _prompt_command() { | |
| PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[33m\]`_git_prompt`\[\033[00m\]\n$ " | |
| } | |
| PROMPT_COMMAND=_prompt_command |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment