Skip to content

Instantly share code, notes, and snippets.

@joshkunz
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshkunz/766ba153eb936f85a05a to your computer and use it in GitHub Desktop.
Save joshkunz/766ba153eb936f85a05a to your computer and use it in GitHub Desktop.
One-Liner to check the integrity of all git repos in the current directory
find . -name '.git' -type d -prune \
| rev | cut -d '/' -f2- | rev | tr '\n' '\0' \
| xargs -0 -n1 -I% bash -c 'echo -n "%..."; cd "%"; git fsck 2>/dev/null 1>&2; if [ $? -eq "0" ]; then printf "\e[32mPASS\e[39m\n"; else printf "\e[31mFAIL\e[39m\n"; fi'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment