Skip to content

Instantly share code, notes, and snippets.

@epall
Created January 10, 2010 23:22
Show Gist options
  • Save epall/273854 to your computer and use it in GitHub Desktop.
Save epall/273854 to your computer and use it in GitHub Desktop.
Garbage collect all git repos in the current directory
#!/bin/sh
startsize=`du -s -h | awk '{print $1}'`
find . -name .git -print0 | xargs -0 -n1 -I{} sh -c "cd {}; git gc"
endsize=`du -s -h | awk '{print $1}'`
echo "$PWD compacted from $startsize to $endsize"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment