I have a bash PS1 to get red if my git directory is changed or green if it has not been changed.
if [ $? -eq 0 ]; then \
echo "$(echo `git status` | grep "nothing to commit" > /dev/null 2>&1; \
if [ "$?" -eq "0" ]; then \
# @4 - Clean repository - nothing to commit
echo "\n'$Green'"$(__git_ps1 "(%s)"'$Color_Off'); \
else \
# @5 - Changes to working tree
echo "\n'$IRed'"$(__git_ps1 "(%s)"'$Color_Off'); \
fi)\$ "; \
fi)'
This work is wonderful! But the problem is that in some works, dir is very slow, because there are many changes and big diff.
What is the best way to get git boolean status (yes changed or not changed) without full
I tried with git status --shortor git status --porcelain, but so far very slowly.
source
share