Skip to content

Instantly share code, notes, and snippets.

@PHLAK
Last active March 19, 2020 17:52
Show Gist options
  • Save PHLAK/827716 to your computer and use it in GitHub Desktop.
Save PHLAK/827716 to your computer and use it in GitHub Desktop.
Performs fsck and gc on all Git repositories in a given directory.
#!/usr/bin/env bash
set -o errexit pipefail
WORKSPACE=${HOME}/workspace # Path to your workspace
find ${WORKSPACE} -name '.git' -type d | while read LINE; do
pushd "${LINE}/../"
git fsck && git gc
popd
done
@PHLAK
Copy link
Author

PHLAK commented Feb 15, 2011

Similar functionality with recursive directory searching: https://gist.github.com/384252d5140caa96bcea

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