{"thread":{"id":"28925","subject":"delete deprecated refs to release disk space","startedAt":"2011-11-13T15:10:33Z","lastAt":"2011-11-16T23:44:22Z","messageCount":4,"participants":["Peter Vereshagin","Ævar Arnfjörð Bjarmason"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"179385","messageId":"20111113151033.GD16065@external.screwed.box","threadId":"28925","inReplyTo":null,"subject":"delete deprecated refs to release disk space","fromName":"Peter Vereshagin","fromEmail":"peter@vereshagin.org","sentAt":"2011-11-13T15:10:33Z","receivedAt":"2011-11-13T15:10:33Z","isPatch":false,"sender":{"key":"peter@vereshagin.org","avatar":"https://gravatar.com/avatar/27a92b8c80743df8621433ca040657c4ac37a78497228d04f703e70731c5f30b?d=mp&s=160"},"body":"Hello.\n\nI use git for sql database backups:\n\n    http://gitweb.vereshagin.org/endvance/blob_plain/HEAD:/endvance/README\n\nAm wondering if there is a way to remove the expired revisions? Following that\nscenario:\n\n    https://gist.github.com/1362183\n\nI think there should be the way to decrease the space that .git takes. Without\ncompression, of course.\n\nNo problem if this involves the overwriting of the history like  filter-branch\ndoes.  But filter-branch doesn't seem to be able to remove the old  info  from\nrepository based on expiration time, does it?\n\nThank you.\n\n--\nPeter Vereshagin <peter@vereshagin.org> (http://vereshagin.org) pgp: A0E26627 \n"},{"id":"179387","messageId":"CACBZZX5kBqM1eye40_Vw0W=8qnNsUQBVCE0q9JrixYomGPuZbg@mail.gmail.com","threadId":"28925","inReplyTo":"20111113151033.GD16065@external.screwed.box","subject":"Re: delete deprecated refs to release disk space","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2011-11-13T17:01:18Z","receivedAt":"2011-11-13T17:01:18Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"2011/11/13 Peter Vereshagin <peter@vereshagin.org>:\n> Hello.\n>\n> I use git for sql database backups:\n>\n>    http://gitweb.vereshagin.org/endvance/blob_plain/HEAD:/endvance/README\n>\n> Am wondering if there is a way to remove the expired revisions? Following that\n> scenario:\n>\n>    https://gist.github.com/1362183\n>\n> I think there should be the way to decrease the space that .git takes. Without\n> compression, of course.\n>\n> No problem if this involves the overwriting of the history like  filter-branch\n> does.  But filter-branch doesn't seem to be able to remove the old  info  from\n> repository based on expiration time, does it?\n\nWhat you're looking for is git-filter-branch + the graft facility. I\ncan't remember the exact invocation, but you echo the sha1 of the\ncommit you want to be the oldest commit to .git/info/grafts, then run\ngit-filter-branch.\n\nYou can use whatever you like to discover that sha1, e.g. keep N\nrevisions (which might be committed once per day) around, or have some\ncustom time limit etc.\n"},{"id":"179429","messageId":"20111114142525.GB8641@external.screwed.box","threadId":"28925","inReplyTo":"CACBZZX5kBqM1eye40_Vw0W=8qnNsUQBVCE0q9JrixYomGPuZbg@mail.gmail.com","subject":"Re: delete deprecated refs to release disk space","fromName":"Peter Vereshagin","fromEmail":"peter@vereshagin.org","sentAt":"2011-11-14T14:25:25Z","receivedAt":"2011-11-14T14:25:25Z","isPatch":false,"sender":{"key":"peter@vereshagin.org","avatar":"https://gravatar.com/avatar/27a92b8c80743df8621433ca040657c4ac37a78497228d04f703e70731c5f30b?d=mp&s=160"},"body":"Hello.\n\n2011/11/13 18:01:18 +0100 ??var Arnfj??r?? Bjarmason <avarab@gmail.com> => To Peter Vereshagin :\nvArB> What you're looking for is git-filter-branch + the graft facility. I\nvArB> can't remember the exact invocation, but you echo the sha1 of the\nvArB> commit you want to be the oldest commit to .git/info/grafts, then run\nvArB> git-filter-branch.\n\nSeem to work for me ( with 'gc' and 'prune' thereafter ) but with these quirks:\n*) the git-filter-branch(1) tells that there must be two ids:\n\n    echo \"$commit-id $graft-id\" >> .git/info/grafts\n\nThis works for me if only one is put there.\n*) I'd like to have a command for this. Is this a '--parent-filter' to make\nthe same thing?\n\nN commits ago is a fine setting for me as it's a cron job backup. Thanks?\n\n--\nPeter Vereshagin <peter@vereshagin.org> (http://vereshagin.org) pgp: A0E26627 \n"},{"id":"179602","messageId":"20111116234422.GA5131@external.screwed.box","threadId":"28925","inReplyTo":"20111114142525.GB8641@external.screwed.box","subject":"Re: delete deprecated refs to release disk space","fromName":"Peter Vereshagin","fromEmail":"peter@vereshagin.org","sentAt":"2011-11-16T23:44:22Z","receivedAt":"2011-11-16T23:44:22Z","isPatch":false,"sender":{"key":"peter@vereshagin.org","avatar":"https://gravatar.com/avatar/27a92b8c80743df8621433ca040657c4ac37a78497228d04f703e70731c5f30b?d=mp&s=160"},"body":"Hello.\n\n2011/11/14 18:25:25 +0400 Peter Vereshagin <peter@vereshagin.org> => To ??var Arnfj??r?? Bjarmason :\nPV> N commits ago is a fine setting for me as it's a cron job backup. Thanks?\n\n* = Thanks!\n\nHere is the PoC QnD code that releases disk space for me by far:\n\n    git rev-list --all --timestamp |\\\n        perl -Mstrict -MTime::ParseDate -wE \\\n            'my $match = 0; my $expire = parsedate( \"3 days ago\" ); while (<>)\n                { chomp; my ( $tstamp => $graft_id ) = split /\\s+/;\n                    if ( not( $match ) and $tstamp < $expire )\n                        { say $graft_id; $match = 1; } }\n            ' > .git/info/grafts && \\\n    git filter-branch -f\n\nfor case a one shall seek for it.\n\n--\nPeter Vereshagin <peter@vereshagin.org> (http://vereshagin.org) pgp: A0E26627 \n"}]}