Skip to content

Instantly share code, notes, and snippets.

@Abizern
Created January 14, 2014 15:26
Show Gist options
  • Save Abizern/8420056 to your computer and use it in GitHub Desktop.
Save Abizern/8420056 to your computer and use it in GitHub Desktop.
Recurse the current directory and run git gc on all bare repositories.
#!/usr/bin/env ruby
# A simple script that recurses through the current directory and runs
# git garbage collection on the bare repositories
Dir.glob("**/*.git") do |dir|
working_dir = File.expand_path dir
puts "#{dir} being garbage collected."
`cd #{working_dir};git gc --aggressive --prune --quiet`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment