Skip to content

Instantly share code, notes, and snippets.

@steinim
Created April 18, 2012 13:07
Show Gist options
  • Save steinim/2413447 to your computer and use it in GitHub Desktop.
Save steinim/2413447 to your computer and use it in GitHub Desktop.
Git garbage collection script
#!/bin/bash
repo_dirs=$( ls -d1 $@ )
for repo_dir in ${repo_dirs[@]}
do
cd $repo_dir
echo "checking if $repo_dir is a git repo"
if [[ -d .git ]]
then
echo "Garbage collecting $repo_dir"
git gc
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment