Created
October 21, 2013 19:02
-
-
Save jaz303/7089132 to your computer and use it in GitHub Desktop.
find all dirty git repos under the current working directory
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
#!/bin/bash | |
for dir in $(find . -name '.git' -type d) | |
do | |
dir=$(dirname $dir) | |
cd $dir | |
STATE="" | |
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then | |
STATE="untracked-files ${STATE}" | |
fi | |
if ! git diff --quiet 2> /dev/null; then | |
STATE="modified ${STATE}" | |
fi | |
if ! git diff --cached --quiet 2> /dev/null; then | |
STATE="staged ${STATE}" | |
fi | |
if [[ -n $STATE ]]; then | |
echo "${dir}: ${STATE}" | |
fi | |
cd - > /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment