{"id":2008,"date":"2014-10-14T11:12:02","date_gmt":"2014-10-14T11:12:02","guid":{"rendered":"http:\/\/blog.designed79.co.uk\/?p=2008"},"modified":"2014-10-14T11:12:02","modified_gmt":"2014-10-14T11:12:02","slug":"clean-up-you-git-repo","status":"publish","type":"post","link":"https:\/\/blog.designed79.co.uk\/?p=2008","title":{"rendered":"Clean up you Git Repo"},"content":{"rendered":"<p>Doing the &#8220;git gc&#8221; reduced my git repo from 17 GB to 787 MB !!!<\/p>\n<blockquote><p>Generally, doing incremental &#8220;git gc&#8221; is the right approach, and better<br \/>\nthan doing &#8220;git gc &#8211;aggressive&#8221;. It&#8217;s going to re-use old deltas, and<br \/>\nwhen those old deltas can&#8217;t be found (the reason for doing incremental GC<br \/>\nin the first place!) it&#8217;s going to create new ones.<\/p>\n<p>On the other hand, it&#8217;s definitely true that an &#8220;initial import of a long<br \/>\nand involved history&#8221; is a point where it can be worth spending a lot of<br \/>\ntime finding the *really*good* deltas. Then, every user ever after (as<br \/>\nlong as they don&#8217;t use &#8220;git gc &#8211;aggressive&#8221; to undo it!) will get the<br \/>\nadvantage of that one-time event. So especially for big projects with a<br \/>\nlong history, it&#8217;s probably worth doing some extra work, telling the delta<br \/>\nfinding code to go wild.<\/p>\n<p>So the equivalent of &#8220;git gc &#8211;aggressive&#8221; &#8211; but done *properly* &#8211; is to<br \/>\ndo (overnight) something like<\/p>\n<p>git repack -a -d &#8211;depth=250 &#8211;window=250<\/p>\n<p>where that depth thing is just about how deep the delta chains can be<br \/>\n(make them longer for old history &#8211; it&#8217;s worth the space overhead), and<br \/>\nthe window thing is about how big an object window we want each delta<br \/>\ncandidate to scan.<\/p>\n<p>And here, you might well want to add the &#8220;-f&#8221; flag (which is the &#8220;drop all<br \/>\nold deltas&#8221;, since you now are actually trying to make sure that this one<br \/>\nactually finds good candidates.<\/p>\n<p>And then it&#8217;s going to take forever and a day (ie a &#8220;do it overnight&#8221;<br \/>\nthing). But the end result is that everybody downstream from that<br \/>\nrepository will get much better packs, without having to spend any effort<br \/>\non it themselves.<\/p>\n<p>Linus<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Doing the &#8220;git gc&#8221; reduced my git repo from 17 GB to 787 MB !!! Generally, doing incremental &#8220;git gc&#8221; is the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2008","post","type-post","status-publish","format-standard","hentry","category-info-on-tech"],"_links":{"self":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2008"}],"version-history":[{"count":0,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2008\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}