Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
find repos without local changes
# 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.

This comment has been minimized.

Copy link
Owner Author

@farrellit farrellit commented Dec 13, 2017

iterating through each repo's branches to check against an upstream in bash? Maybe doable easily enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment