Created
December 13, 2017 23:32
-
-
Save farrellit/8cc1c16449ee04170103a73bec1c85d1 to your computer and use it in GitHub Desktop.
find repos without local 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
# find directories containing .git subdirs | |
find ~/ -type d -name '.git' -print0 | xargs -n 1 -0 dirname \ | |
| xargs -I % -n 1 bash -c 'cd "%" && pwd 1>&2; (git status --porcelain| grep -q . && [[ ! -n "`git diff`" ]] ) || echo %'\ | |
| xargs -I % bash -c '[[ -n "`cd %; git status --porcelain; git diff;`" ]] && echo %' \ | |
| tee /dev/stderr | sort > purportedly-empty-repos.txt | |
#That makes sure you don't have any uncommitted changes. But it still doesn't check to make sure you don't have unpushed commits. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
iterating through each repo's branches to check against an upstream in bash? Maybe doable easily enough.