{"thread":{"id":"30414","subject":"git gc == git garbage-create from removed branch","startedAt":"2012-05-03T18:38:42Z","lastAt":"2012-05-04T08:58:15Z","messageCount":3,"participants":["Hallvard Breien Furuseth","Andreas Ericsson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"190671","messageId":"hbf.20120503q14w@bombur.uio.no","threadId":"30414","inReplyTo":null,"subject":"git gc == git garbage-create from removed branch","fromName":"Hallvard Breien Furuseth","fromEmail":"h.b.furuseth@usit.uio.no","sentAt":"2012-05-03T18:38:42Z","receivedAt":"2012-05-03T18:38:42Z","isPatch":false,"sender":{"key":"h.b.furuseth@usit.uio.no","avatar":null},"body":"After removing a branch, 'git gc' explodes all objects\nwhich were only in that branch.  Git filled up my disk that\nway when I had cherry-picked from a big remote repo and then\ndid git remote rm.  Tested with Git 1.7.10.1 and 1.7.1.\n\n$ git clone --bare --branch linux-overhaul-20010122 \\\n\tgit://git.savannah.gnu.org/config.git\n...\nReceiving objects: 100% (3263/3263), 517.15 KiB | 295 KiB/s, done.\n...\n$ cd config.git/\n$ git tag -d `git tag`\n...\n$ git branch -D master\n$ git gc\nCounting objects: 1183, done.\nDelta compression using up to 2 threads.\nCompressing objects: 100% (751/751), done.\nWriting objects: 100% (1183/1183), done.\nTotal 1183 (delta 457), reused 1113 (delta 393)\n\n$ find objects/?? -type f -print | wc -l\n2080\n\n$ git reflog expire --expire=now; git gc --prune=now\nCounting objects: 1183, done.\nDelta compression using up to 2 threads.\nCompressing objects: 100% (687/687), done.\nWriting objects: 100% (1183/1183), done.\nTotal 1183 (delta 457), reused 1183 (delta 457)\n\n$ ls objects/\ninfo/  pack/\n\n3263 fetched objects == 2080 loose objects before prune +\nHEAD's 1183 objects.\n\n-- \nHallvard\n"},{"id":"190734","messageId":"4FA38731.8010504@op5.se","threadId":"30414","inReplyTo":"hbf.20120503q14w@bombur.uio.no","subject":"Re: git gc == git garbage-create from removed branch","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2012-05-04T07:37:21Z","receivedAt":"2012-05-04T07:37:21Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"On 05/03/2012 08:38 PM, Hallvard Breien Furuseth wrote:\n> After removing a branch, 'git gc' explodes all objects\n> which were only in that branch.  Git filled up my disk that\n> way when I had cherry-picked from a big remote repo and then\n> did git remote rm.  Tested with Git 1.7.10.1 and 1.7.1.\n> \n\nThat's by design. It's added to save people who accidentally\ndelete a branch or for some other reason really want to keep the\nobjects they're about to delete.\n\nUse 'git gc --prune=now' with a recent* git and you'll avoid the\nproblem.\n\n* Recent enough to include the patch that avoids writing out loose\nobjects when they would be auto-deleted by the following pruning.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n\nConsidering the successes of the wars on alcohol, poverty, drugs and\nterror, I think we should give some serious thought to declaring war\non peace.\n"},{"id":"190737","messageId":"7c72f0810ec9647a9835e87ad100b603@ulrik.uio.no","threadId":"30414","inReplyTo":"4FA38731.8010504@op5.se","subject":"Re: git gc == git garbage-create from removed branch","fromName":"Hallvard Breien Furuseth","fromEmail":"h.b.furuseth@usit.uio.no","sentAt":"2012-05-04T08:58:15Z","receivedAt":"2012-05-04T08:58:15Z","isPatch":false,"sender":{"key":"h.b.furuseth@usit.uio.no","avatar":null},"body":" On Fri, 04 May 2012 09:37:21 +0200, Andreas Ericsson <ae@op5.se> wrote:\n> On 05/03/2012 08:38 PM, Hallvard Breien Furuseth wrote:\n>> After removing a branch, 'git gc' explodes all objects\n>> which were only in that branch.  Git filled up my disk that\n>> way when I had cherry-picked from a big remote repo and then\n>> did git remote rm.  Tested with Git 1.7.10.1 and 1.7.1.\n>\n> That's by design. It's added to save people who accidentally\n> delete a branch or for some other reason really want to keep the\n> objects they're about to delete.\n\n Keeping old objects for a while is by design, which I appreciate.\n\n Consuming gigabytes of disk space for this is a design bug.  Git should\n pack such objects when they breed too fast, just like other objects.\n\n If that's a hard design issue to get around, git gc should at least\n catch this and stop unless the user forces gc with some option.\n Users should not need to know that in certain circumstances, gc will\n ravenously eat their disk space without even giving advance notice.\n\n> Use 'git gc --prune=now' with a recent* git and you'll avoid the\n> problem.\n\n I don't want to prune.  Old objects have indeed saved me from\n accidents, as you mention.\n\n But it's good to know I don't need to throw away the reflog too.\n Thanks.\n\n Hallvard\n"}]}