{ Josh Rendek }

<3 Go & Kubernetes · honeypots · homelab · leadership

Quickly compress git repository folders to save space

Aug 26, 2010 · 1 min

I keep all my Rails stuff in one folder (called apps) and I needed to clean up some disk space to keep my SSD sane, so I wrote this quick little ruby snippet to go through each directory and compress it:

#!/usr/bin/env ruby

files = Dir.glob("*")

for f in files
   if File.directory?(f) then
       p `cd #{f}; /usr/local/bin/git gc`
   end
end
comments powered by Disqus