Created
December 16, 2015 22:55
-
-
Save justincy/67f7e505296a4b4cd478 to your computer and use it in GitHub Desktop.
Iterate over all sub directories and print a list of which git repos have uncommitted changes.
This file contains 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 | |
# Loop through all files and directories | |
for dir in ./* | |
do | |
# Skip files | |
if [ -d $dir ]; then | |
cd $dir; | |
# Filter down to only git repos | |
if [ -d ".git" ]; then | |
# Print repos that have uncommitted changes | |
# http://stackoverflow.com/a/9393642 | |
if [[ -n $(git status -s) ]]; then | |
echo $dir; | |
fi; | |
fi; | |
cd ..; | |
fi; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment