Skip to content

Instantly share code, notes, and snippets.

@ekazakov
Forked from garybernhardt/gist:b1a8cc6eacbfa9ea8100
Last active August 29, 2015 14:09
Show Gist options
  • Save ekazakov/754c0057efa8b41981f6 to your computer and use it in GitHub Desktop.
Save ekazakov/754c0057efa8b41981f6 to your computer and use it in GitHub Desktop.
git check repos
# Has your OS/FS/disk lost your data?
# cd to the directory containing your project repositories and run the command
# below. (It's long; make sure you get it all.) It finds all of your git repos
# and runs paranoid fscks in them to check their integrity.
(set -e && find . -type d -and -iname '.git' | while read p; do (cd "$(dirname "$p")" && (set -x && git fsck --full --strict)); done) && echo "OK"
# I have 81 git repos in my ~/proj directory and had no errors.
# You might get messages about dangling commits, dangling blobs, etc. Those
# aren't errors. If it prints "OK" at the end, your repos are all valid.
# Please leave a comment here saying whether the command succeeded or not (even
# if it said "OK"!). Also name your OS and file system. If it failed, please
# paste the bottom of the error, starting with the last "git fsck" command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment