Created
November 14, 2014 21:29
-
-
Save catrope/309b10c300dd13c40c61 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
source /etc/bash_completion.d/git-prompt | |
GIT_PS1_SHOWDIRTYSTATE='yes' | |
function git_dirty { | |
# only tracks modifications, not unknown files needing adds | |
if [ -z "`git status -s 2> /dev/null | awk '{print $1}' | grep '[ADMTU]'`" ] ; then | |
return 1 | |
else | |
return 0 | |
fi | |
} | |
function dirty_git_prompt { | |
git_dirty && __git_ps1 | |
} | |
function clean_git_prompt { | |
git_dirty || __git_ps1 | |
} | |
function git_prompt_if_dirty { | |
if [[ "$1" =~ .*(\*|\+).* ]]; then | |
echo "$1" | |
fi | |
} | |
function git_prompt_if_clean { | |
if [[ "$1" =~ .*(\*|\+).* ]]; then | |
true | |
else | |
echo "$1" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment