{"thread":{"id":"10181","subject":"Trying to use git-filter-branch to compress history by removing large, obsolete binary files","startedAt":"2007-10-07T21:23:59Z","lastAt":"2007-10-09T10:37:26Z","messageCount":31,"participants":["Elijah Newren","Frank Lichtenheld","Alex Riesen","Johannes Schindelin","Dmitry Potapov","J. Bruce Fields","Sam Vilain","Johannes Sixt","Andreas Ericsson","Karl Hasselström","Theodore Tso"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"55088","messageId":"51419b2c0710071423y1b194f22gb6ccaa57303029d1@mail.gmail.com","threadId":"10181","inReplyTo":null,"subject":"Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2007-10-07T21:23:59Z","receivedAt":"2007-10-07T21:23:59Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi,\n\nI'm using git-cvsimport to import some CVS repos, which unfortunately\nincluded dozens of large regression test output files in their ancient\nhistory...some of which measure hundreds of megabytes in size.  I'd\nlike to prune them out of the git history (I don't have access to\nprune them out of the CVS history), but I'm running into problems.\n\nThe following set of instructions will duplicate my problem with a\nsmaller repo; why is the local git repository bigger after running\ngit-filter-branch rather than smaller as I'd expect?  I'm probably\nmissing something obvious, but I have no idea what it is.\n\nThe steps:\n\n# Make a small repo\nmkdir test\ncd test\ngit init\necho hi > there\ngit add there\ngit commit -m 'Small repo'\n\n# Add a random 10M binary file\ndd if=/dev/urandom of=testme.txt count=10 bs=1M\ngit add testme.txt\ngit commit -m 'Add big binary file'\n\n# Remove the 10M binary file\ngit rm testme.txt\ngit commit -m 'Remove big binary file'\n\n# Compress the repo, see how big the repo is\ngit gc --aggressive --prune\ndu -ks .                       # 10548K\ndu -ks .git                    # 10532K\n\n# Try to rewrite history to remove the binary file\ngit-filter-branch --tree-filter 'rm -f testme.txt' HEAD\ngit reset --hard\n\n# Try to recompress and clean up, then check the new size\ngit gc --aggressive --prune\ndu -ks .                       # 10580K !?!?!?\ndu -ks .git                    # 10564K\n\n\nThanks,\nElijah\n"},{"id":"55091","messageId":"20071007213817.GJ31659@planck.djpig.de","threadId":"10181","inReplyTo":"51419b2c0710071423y1b194f22gb6ccaa57303029d1@mail.gmail.com","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-10-07T21:38:17Z","receivedAt":"2007-10-07T21:38:17Z","isPatch":false,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Sun, Oct 07, 2007 at 03:23:59PM -0600, Elijah Newren wrote:\n> The following set of instructions will duplicate my problem with a\n> smaller repo; why is the local git repository bigger after running\n> git-filter-branch rather than smaller as I'd expect?  I'm probably\n> missing something obvious, but I have no idea what it is.\n\nThe usual suspect would be the reflog.\n\nGruesse,\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"},{"id":"55097","messageId":"51419b2c0710071500x318ee734n9db6ca9e6daa3196@mail.gmail.com","threadId":"10181","inReplyTo":"20071007213817.GJ31659@planck.djpig.de","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2007-10-07T22:00:51Z","receivedAt":"2007-10-07T22:00:51Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On 10/7/07, Frank Lichtenheld <frank@lichtenheld.de> wrote:\n> On Sun, Oct 07, 2007 at 03:23:59PM -0600, Elijah Newren wrote:\n> > The following set of instructions will duplicate my problem with a\n> > smaller repo; why is the local git repository bigger after running\n> > git-filter-branch rather than smaller as I'd expect?  I'm probably\n> > missing something obvious, but I have no idea what it is.\n>\n> The usual suspect would be the reflog.\n\nThe git-filter-branch documentation mentions creating refs/original\nunder .git.  Unfortunately, it doesn't contain any links or\ndocumentation on how I'd clean those out and I haven't been able to\nfigure it out.  I asked on #git how to clean these out and got some\nanswers that didn't work (git branch -d and something else I don't\nremember).  So...how do I fix the reflog, and then repack to have a\npack under 11MB in size?\n\nThanks,\nElijah\n"},{"id":"55098","messageId":"20071007220853.GE2765@steel.home","threadId":"10181","inReplyTo":"51419b2c0710071423y1b194f22gb6ccaa57303029d1@mail.gmail.com","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-10-07T22:08:53Z","receivedAt":"2007-10-07T22:08:53Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Elijah Newren, Sun, Oct 07, 2007 23:23:59 +0200:\n> # Try to recompress and clean up, then check the new size\n> git gc --aggressive --prune\n> du -ks .                       # 10580K !?!?!?\n> du -ks .git                    # 10564K\n\ngit-filter-branch makes a backup of your original references:\n\n$ git filter-branch --help\n...\n       Always verify that the rewritten version is correct: The original refs,\n       if different from the rewritten ones, will be stored in the namespace\n       refs/original/.\n...\n\nThese will keep your big files in repository.\n"},{"id":"55100","messageId":"20071007221920.GF2765@steel.home","threadId":"10181","inReplyTo":"51419b2c0710071500x318ee734n9db6ca9e6daa3196@mail.gmail.com","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-10-07T22:19:20Z","receivedAt":"2007-10-07T22:19:20Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Elijah Newren, Mon, Oct 08, 2007 00:00:51 +0200:\n> On 10/7/07, Frank Lichtenheld <frank@lichtenheld.de> wrote:\n> > On Sun, Oct 07, 2007 at 03:23:59PM -0600, Elijah Newren wrote:\n> > > The following set of instructions will duplicate my problem with a\n> > > smaller repo; why is the local git repository bigger after running\n> > > git-filter-branch rather than smaller as I'd expect?  I'm probably\n> > > missing something obvious, but I have no idea what it is.\n> >\n> > The usual suspect would be the reflog.\n> \n> The git-filter-branch documentation mentions creating refs/original\n> under .git.  Unfortunately, it doesn't contain any links or\n> documentation on how I'd clean those out and I haven't been able to\n> figure it out.  I asked on #git how to clean these out and got some\n> answers that didn't work (git branch -d and something else I don't\n> remember).\n\nrm -rf .git/refs/original/refs/heads/<the branch where HEAD pointed to>\n(assuming you haven't repacked yet)\n\nor just edit .git/packed-refs and remove everything \"refs/original\"\nwhich fits the criteria\n\n> So...how do I fix the reflog, and then repack to have a\n> pack under 11MB in size?\n\ngit reflog expire --all (it is a bit to much. You can just edit\n.git/logs/* in any text editor)\n"},{"id":"55102","messageId":"51419b2c0710071524q16e9c593s2722dffc826e560d@mail.gmail.com","threadId":"10181","inReplyTo":"20071007221920.GF2765@steel.home","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2007-10-07T22:24:49Z","receivedAt":"2007-10-07T22:24:49Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On 10/7/07, Alex Riesen <raa.lkml@gmail.com> wrote:\n<snip>\n> rm -rf .git/refs/original/refs/heads/<the branch where HEAD pointed to>\n> (assuming you haven't repacked yet)\n>\n> or just edit .git/packed-refs and remove everything \"refs/original\"\n> which fits the criteria\n>\n> > So...how do I fix the reflog, and then repack to have a\n> > pack under 11MB in size?\n>\n> git reflog expire --all (it is a bit to much. You can just edit\n> .git/logs/* in any text editor)\n\nSo...\n\n$ du -hs .\n11M     .\n$ rm -rf .git/refs/original/\n$ vi .git/packed-refs\n# Remove the line referring to refs/original...\n$ git reflog expire --all\n$ git gc --aggressive --prune\n$ du -hs .\n11M     .\n\nIt's still 11MB.\n\nAny other ideas?\n\nElijah\n"},{"id":"55117","messageId":"Pine.LNX.4.64.0710080018270.4174@racer.site","threadId":"10181","inReplyTo":"51419b2c0710071500x318ee734n9db6ca9e6daa3196@mail.gmail.com","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-07T23:19:12Z","receivedAt":"2007-10-07T23:19:12Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 7 Oct 2007, Elijah Newren wrote:\n\n> So...how do I fix the reflog, and then repack to have a pack under 11MB \n> in size?\n\nJust clone it.  The clone will be much smaller.\n\nCiao,\nDscho\n"},{"id":"55118","messageId":"51419b2c0710071624v79dc02d2g35a265add50dd46d@mail.gmail.com","threadId":"10181","inReplyTo":"Pine.LNX.4.64.0710080018270.4174@racer.site","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2007-10-07T23:24:07Z","receivedAt":"2007-10-07T23:24:07Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On 10/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> Hi,\n>\n> On Sun, 7 Oct 2007, Elijah Newren wrote:\n>\n> > So...how do I fix the reflog, and then repack to have a pack under 11MB\n> > in size?\n>\n> Just clone it.  The clone will be much smaller.\n\n$ git clone test test2\n<snip>\n$ du -hs test\n11M     test\n$ du -hs test2\n11M     test2\n\nAny other ideas?\n"},{"id":"55126","messageId":"Pine.LNX.4.64.0710080028301.4174@racer.site","threadId":"10181","inReplyTo":"51419b2c0710071624v79dc02d2g35a265add50dd46d@mail.gmail.com","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-07T23:28:55Z","receivedAt":"2007-10-07T23:28:55Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 7 Oct 2007, Elijah Newren wrote:\n\n> On 10/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n>\n> > On Sun, 7 Oct 2007, Elijah Newren wrote:\n> >\n> > > So...how do I fix the reflog, and then repack to have a pack under \n> > > 11MB in size?\n> >\n> > Just clone it.  The clone will be much smaller.\n> \n> $ git clone test test2\n> <snip>\n> $ du -hs test\n> 11M     test\n> $ du -hs test2\n> 11M     test2\n> \n> Any other ideas?\n\nYep.  Maybe it is necessary to run \"git gc\" in test2.\n\nCiao,\nDscho\n"},{"id":"55130","messageId":"51419b2c0710071638p6dcc0c7cm2a813c22758e6f32@mail.gmail.com","threadId":"10181","inReplyTo":"Pine.LNX.4.64.0710080028301.4174@racer.site","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2007-10-07T23:38:55Z","receivedAt":"2007-10-07T23:38:55Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Hi,\n\nOn 10/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> On Sun, 7 Oct 2007, Elijah Newren wrote:\n<snip>\n> > $ git clone test test2\n> > <snip>\n> > $ du -hs test\n> > 11M     test\n> > $ du -hs test2\n> > 11M     test2\n> >\n> > Any other ideas?\n>\n> Yep.  Maybe it is necessary to run \"git gc\" in test2.\n\nSweet, finally solved!  That brings test2 down to 340K.\n\nHowever, the solution seems somewhat involved...it requires running\ngit-filter-branch, git reset, removing the .git/refs/original/\ndirectory, editing .git/packed-refs in some editor, running git reflog\nexpire, cloning the resulting repository, and running git gc yet\nagain.  It seems like there has to be an easier way.  (Anyone have\none?)\n\nOh, and git-filter-branch could really use some explanatory note about\nhow to actually complete rewriting the history.\n\nThanks,\nElijah\n"},{"id":"55134","messageId":"20071007234039.GH2765@steel.home","threadId":"10181","inReplyTo":"51419b2c0710071524q16e9c593s2722dffc826e560d@mail.gmail.com","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-10-07T23:40:39Z","receivedAt":"2007-10-07T23:40:39Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Elijah Newren, Mon, Oct 08, 2007 00:24:49 +0200:\n> On 10/7/07, Alex Riesen <raa.lkml@gmail.com> wrote:\n> > rm -rf .git/refs/original/refs/heads/<the branch where HEAD pointed to>\n> > (assuming you haven't repacked yet)\n> >\n> > or just edit .git/packed-refs and remove everything \"refs/original\"\n> > which fits the criteria\n> >\n> > > So...how do I fix the reflog, and then repack to have a\n> > > pack under 11MB in size?\n> >\n> > git reflog expire --all (it is a bit to much. You can just edit\n> > .git/logs/* in any text editor)\n> \n> So...\n> \n> $ du -hs .\n> 11M     .\n> $ rm -rf .git/refs/original/\n> $ vi .git/packed-refs\n> # Remove the line referring to refs/original...\n> $ git reflog expire --all\n> $ git gc --aggressive --prune\n> $ du -hs .\n> 11M     .\n> \n> It's still 11MB.\n> \n> Any other ideas?\n\nyou missed something. Your example compresses to about 124k.\n"},{"id":"55135","messageId":"20071007234346.GA29433@potapov","threadId":"10181","inReplyTo":"51419b2c0710071524q16e9c593s2722dffc826e560d@mail.gmail.com","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2007-10-07T23:43:47Z","receivedAt":"2007-10-07T23:43:47Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Sun, Oct 07, 2007 at 04:24:49PM -0600, Elijah Newren wrote:\n> $ git reflog expire --all\n> $ git gc --aggressive --prune\n\nI believe this should work:\n\ngit reflog expire --all --expire-unreachable=0\ngit gc --prune\n\nWarning: all unreachable references will be removed!\n\nDmitry\n"},{"id":"55136","messageId":"51419b2c0710071709s2f797df0u986447f5455f306d@mail.gmail.com","threadId":"10181","inReplyTo":"20071007234039.GH2765@steel.home","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2007-10-08T00:09:50Z","receivedAt":"2007-10-08T00:09:50Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On 10/7/07, Alex Riesen <raa.lkml@gmail.com> wrote:\n> you missed something. Your example compresses to about 124k.\n\nWhat version of git are you running?  I reran all the steps to which\nyou responded (repeated below for clarity) with git-1.5.3.3 and still\nget 11MB.  Also, you must have different filesystem extents than me\nsince an empty git repo takes 196k here[1], so I don't think any repo\nis going to get down to 124k.\n\nMy understanding of the steps you suggest would work:\n\n# Make a small repo\nmkdir test\ncd test\ngit init\necho hi > there\ngit add there\ngit commit -m 'Small repo'\n\n# Add a random 10M binary file\ndd if=/dev/urandom of=testme.txt count=10 bs=1M\ngit add testme.txt\ngit commit -m 'Add big binary file'\n\n# Remove the 10M binary file\ngit rm testme.txt\ngit commit -m 'Remove big binary file'\n\n# Compress the repo, see how big the repo is\ngit gc --aggressive --prune\ndu -ks .                       # 10548K\ndu -ks .git                    # 10532K\n\n# Try to rewrite history to remove the binary file\ngit-filter-branch --tree-filter 'rm -f testme.txt' HEAD\ngit reset --hard\n\n# Try to recompress and clean up, then check the new size\ngit gc --aggressive --prune\ndu -ks .                       # 10580K !?!?!?\ndu -ks .git                    # 10564K\n\n# Do the stuff Alex suggests to trim the history\nrm -rf .git/refs/original/\nvi .git/packed-refs\n# Use vi to remove the line referring to refs/original...\ngit reflog expire --all\ngit gc --aggressive --prune\ndu -ks .                      # Still 10564K\n\n\nThanks,\nElijah\n\n[1] An empty git repo takes 196k for me, as can be seen by:\n$mkdir tmp\n$cd tmp\n$git init\n$du -hs .\n196K    .\n"},{"id":"55137","messageId":"51419b2c0710071722k576c06d9i2f4dce730eae2059@mail.gmail.com","threadId":"10181","inReplyTo":"20071007234346.GA29433@potapov","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2007-10-08T00:22:28Z","receivedAt":"2007-10-08T00:22:28Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On 10/7/07, Dmitry Potapov <dpotapov@gmail.com> wrote:\n> On Sun, Oct 07, 2007 at 04:24:49PM -0600, Elijah Newren wrote:\n> > $ git reflog expire --all\n> > $ git gc --aggressive --prune\n>\n> I believe this should work:\n>\n> git reflog expire --all --expire-unreachable=0\n> git gc --prune\n\nYes, this seems to work.  So the history-rewriting steps are\n\ngit-filter-branch --tree-filter 'rm -f testme.txt' HEAD\ngit reset --hard\nrm -rf .git/refs/original/\nvi .git/packed-refs\n# Use vi to remove the line referring to refs/original...\ngit reflog expire --all --expire-unreachable=0\ngit gc --prune\n\nSeems like a wrapper is needed.  :-)\n\n> Warning: all unreachable references will be removed!\n\nWhat other scenarios could lead to unreachable references?  I don't\nknow how to determine whether this is safe or not (except that these\nwere test repositories anyway, so I don't care what happens to them).\n\nThanks!\nElijah\n"},{"id":"55138","messageId":"Pine.LNX.4.64.0710080129480.4174@racer.site","threadId":"10181","inReplyTo":"51419b2c0710071638p6dcc0c7cm2a813c22758e6f32@mail.gmail.com","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-08T00:34:07Z","receivedAt":"2007-10-08T00:34:07Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 7 Oct 2007, Elijah Newren wrote:\n\n> On 10/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> > On Sun, 7 Oct 2007, Elijah Newren wrote:\n> <snip>\n> > > $ git clone test test2\n> > > <snip>\n> > > $ du -hs test\n> > > 11M     test\n> > > $ du -hs test2\n> > > 11M     test2\n> > >\n> > > Any other ideas?\n> >\n> > Yep.  Maybe it is necessary to run \"git gc\" in test2.\n> \n> Sweet, finally solved!  That brings test2 down to 340K.\n> \n> However, the solution seems somewhat involved...it requires running \n> git-filter-branch, git reset, removing the .git/refs/original/ \n> directory, editing .git/packed-refs in some editor, running git reflog \n> expire, cloning the resulting repository, and running git gc yet again.  \n> It seems like there has to be an easier way.  (Anyone have one?)\n\nIt should be as easy as git filter-branch and git clone.\n\n> Oh, and git-filter-branch could really use some explanatory note about \n> how to actually complete rewriting the history.\n\nIt does what it should do.  It is _your_ task to look at refs/original/* \nif everything went alright.  Then you just delete the checked refs.\n\nWhat made your case so cumbersome was that you wanted the big objects out \n_now_, instead of having them in for a grace period.  BTW this grace \nperiod is in place to help _you_, not the program.  (In case you fscked up \nand need those objects back.)\n\nCiao,\nDscho\n"},{"id":"55139","messageId":"51419b2c0710071747w14d0c265x2de42fca50552394@mail.gmail.com","threadId":"10181","inReplyTo":"Pine.LNX.4.64.0710080129480.4174@racer.site","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2007-10-08T00:47:00Z","receivedAt":"2007-10-08T00:47:00Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On 10/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> It should be as easy as git filter-branch and git clone.\n\nYes, a git filter-branch, git clone, AND git gc in the clone avoids\nall those funny ref editing commands.  However, cloning a 5.6GB repo\n(the size of one of the real repos I'm dealing with) will likely take\na long time (and may push me past the limits of disk space), so using\nother steps to avoid the need to clone actually seems nicer.\n\n> > Oh, and git-filter-branch could really use some explanatory note about\n> > how to actually complete rewriting the history.\n>\n> It does what it should do.  It is _your_ task to look at refs/original/*\n> if everything went alright.  Then you just delete the checked refs.\n>\n> What made your case so cumbersome was that you wanted the big objects out\n> _now_, instead of having them in for a grace period.  BTW this grace\n> period is in place to help _you_, not the program.  (In case you fscked up\n> and need those objects back.)\n\nSure, I think that's a sane default.  And I think it's fine that it\nshould be my task to look at the refs to check that everything worked\nokay and delete them.  But it's nearly impossible to figure out how to\ndo that!  _That_ is my complaint.  I got multiple misleading or\nincomplete answers (both on this list and in #git) before getting some\nworking solutions, so this task is obviously far from trivial.  I\nreally think that adding instructions about how to check and delete\nthe relevant refs would be a very useful addition to the\ndocumentation.\n\nThanks everyone for the help!\n\nElijah\n"},{"id":"55140","messageId":"20071008010033.GA25654@fieldses.org","threadId":"10181","inReplyTo":"Pine.LNX.4.64.0710080129480.4174@racer.site","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2007-10-08T01:00:33Z","receivedAt":"2007-10-08T01:00:33Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"On Mon, Oct 08, 2007 at 01:34:07AM +0100, Johannes Schindelin wrote:\n> It does what it should do.  It is _your_ task to look at refs/original/* \n> if everything went alright.  Then you just delete the checked refs.\n\nIt seems odd to me, by the way, that filter-branch has its own\nhome-grown backup mechanism.  Lots of other commands can \"lose\" commits,\nbut none of them keep an extra backup like this.\n\nAnd I find it tedious for quicker jobs which it might otherwise be\nuseful for (e.g. rewrites of commits in my tree not yet in upstream),\nunless I wrap it in a script that cleans up after itself.\n\n--b.\n"},{"id":"55141","messageId":"Pine.LNX.4.64.0710080204140.4174@racer.site","threadId":"10181","inReplyTo":"20071008010033.GA25654@fieldses.org","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-08T01:06:21Z","receivedAt":"2007-10-08T01:06:21Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 7 Oct 2007, J. Bruce Fields wrote:\n\n> On Mon, Oct 08, 2007 at 01:34:07AM +0100, Johannes Schindelin wrote:\n> > It does what it should do.  It is _your_ task to look at refs/original/* \n> > if everything went alright.  Then you just delete the checked refs.\n> \n> It seems odd to me, by the way, that filter-branch has its own \n> home-grown backup mechanism.  Lots of other commands can \"lose\" commits, \n> but none of them keep an extra backup like this.\n\nThe rationale was this: filter-branch recently learnt how to rewrite many \nbranches, and it might be tedious to find out which ones.  But then, there \nis git log --no-walk --all, so maybe I really should get rid of \nrefs/original/*?\n\nI'd like to have some comments from the heavier filter-branch users on \nthat...\n\nCiao,\nDscho\n"},{"id":"55142","messageId":"20071008010648.GB29433@potapov","threadId":"10181","inReplyTo":"51419b2c0710071722k576c06d9i2f4dce730eae2059@mail.gmail.com","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2007-10-08T01:06:48Z","receivedAt":"2007-10-08T01:06:48Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Sun, Oct 07, 2007 at 06:22:28PM -0600, Elijah Newren wrote:\n> \n> git-filter-branch --tree-filter 'rm -f testme.txt' HEAD\n> git reset --hard\n> rm -rf .git/refs/original/\n> vi .git/packed-refs\n> # Use vi to remove the line referring to refs/original...\n> git reflog expire --all --expire-unreachable=0\n> git gc --prune\n> \n> Seems like a wrapper is needed.  :-)\n\nActually, I would rather not, because you rarely need to remove anything\nimmediately, and 30 days delay is reasonable time to give you a chance\nto recover that you removed accidentally. You can reduce it by setting\nappropriate value for gc.reflogExpireUnreachable in your configuration.\nThe only thing you need to do is to remove .git/refs/original/heads/something\nafter you are sure that git-filter-branch did exactly what you wanted.\n\n> \n> > Warning: all unreachable references will be removed!\n> \n> What other scenarios could lead to unreachable references?\n\nAny re-writing of history leads to that.\n\n> I don't\n> know how to determine whether this is safe or not (except that these\n> were test repositories anyway, so I don't care what happens to them).\n\nGit logs all your action, so even re-writing history would not be\nso disastrous if you suddenly realized that you did something wrong.\nThe history is stored for 30 days by default. Usually, you do not\nneed to mess with Git internals like you did above. Your useless\nfiles still will disappear after being unreachable for 30 days.\n\nOTOH, if you want to have a clean repository immediately, I believe\n'git clone' is a better option. After you made a local clone using\nit, 'git gc' should remove old garbage.\n\nDmitry\n"},{"id":"55149","messageId":"470995C7.40606@vilain.net","threadId":"10181","inReplyTo":"51419b2c0710071747w14d0c265x2de42fca50552394@mail.gmail.com","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2007-10-08T02:28:23Z","receivedAt":"2007-10-08T02:28:23Z","isPatch":false,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Elijah Newren wrote:\n> On 10/7/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n>> It should be as easy as git filter-branch and git clone.\n> \n> Yes, a git filter-branch, git clone, AND git gc in the clone avoids\n> all those funny ref editing commands.  However, cloning a 5.6GB repo\n> (the size of one of the real repos I'm dealing with) will likely take\n> a long time (and may push me past the limits of disk space), so using\n> other steps to avoid the need to clone actually seems nicer.\n\nYou can just delete the logs and references that you don't want and run\ngit gc --prune.\n\nHowever.\n\ngit gc creates a new pack before deleting the old one.  Garbage\ncollection usually does this; make a copy of everything to a new place\nand then free all of the old space.  If *that* is a problem, ie you\ndon't have enough space for two copies of the repository and the junk,\nyou'll have to do a partial import, leave the junk you don't want\nunpacked, cleanup and prune, then finish the import.  Which sounds like\na lot of hassle when you should really just find a place with more space\nto work with!\n\nSam.\n"},{"id":"55162","messageId":"20071008061511.GA2859@steel.home","threadId":"10181","inReplyTo":"51419b2c0710071709s2f797df0u986447f5455f306d@mail.gmail.com","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-10-08T06:15:11Z","receivedAt":"2007-10-08T06:15:11Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Elijah Newren, Mon, Oct 08, 2007 02:09:50 +0200:\n> On 10/7/07, Alex Riesen <raa.lkml@gmail.com> wrote:\n> > you missed something. Your example compresses to about 124k.\n> \n> What version of git are you running?  I reran all the steps to which\n\ngit version 1.5.3.4.225.g31b973 (irrelevant custom modifications)\n\n> you responded (repeated below for clarity) with git-1.5.3.3 and still\n> get 11MB.  Also, you must have different filesystem extents than me\n> since an empty git repo takes 196k here[1], so I don't think any repo\n> is going to get down to 124k.\n\nit is ext3. I do not install the hooks (~8k apparent, ~32k fs blocks)\nand never activate logs by default.\n\n> # Use vi to remove the line referring to refs/original...\n> git reflog expire --all\n\nanother part of the suggestion re reflogs was to look into the logs,\nto check if expire actually removed anything. It seems to have been\nthe culprit.\n"},{"id":"55163","messageId":"4709CCB2.4000202@viscovery.net","threadId":"10181","inReplyTo":"Pine.LNX.4.64.0710080204140.4174@racer.site","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2007-10-08T06:22:42Z","receivedAt":"2007-10-08T06:22:42Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Johannes Schindelin schrieb:\n> The rationale was this: filter-branch recently learnt how to rewrite many \n> branches, and it might be tedious to find out which ones.  But then, there \n> is git log --no-walk --all, so maybe I really should get rid of \n> refs/original/*?\n> \n> I'd like to have some comments from the heavier filter-branch users on \n> that...\n\nIMHO, a backup of the original refs is needed. However, it may be wise to \nstore them in the refs/heads namespace so that 'git branch -d' can delete \nthem and 'git branch -m' can move them back if something went wrong.\n\n-- Hannes\n"},{"id":"55177","messageId":"4709F70F.4040700@op5.se","threadId":"10181","inReplyTo":"20071008061511.GA2859@steel.home","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2007-10-08T09:23:27Z","receivedAt":"2007-10-08T09:23:27Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Alex Riesen wrote:\n> Elijah Newren, Mon, Oct 08, 2007 02:09:50 +0200:\n>> On 10/7/07, Alex Riesen <raa.lkml@gmail.com> wrote:\n>>> you missed something. Your example compresses to about 124k.\n>> What version of git are you running?  I reran all the steps to which\n> \n> git version 1.5.3.4.225.g31b973 (irrelevant custom modifications)\n> \n>> you responded (repeated below for clarity) with git-1.5.3.3 and still\n>> get 11MB.  Also, you must have different filesystem extents than me\n>> since an empty git repo takes 196k here[1], so I don't think any repo\n>> is going to get down to 124k.\n> \n> it is ext3. I do not install the hooks (~8k apparent, ~32k fs blocks)\n> and never activate logs by default.\n> \n>> # Use vi to remove the line referring to refs/original...\n>> git reflog expire --all\n> \n> another part of the suggestion re reflogs was to look into the logs,\n> to check if expire actually removed anything. It seems to have been\n> the culprit.\n> \n\nOn my system, running git version 1.5.3.3.131.g34c6d,\n\n\tgit reflog expire --all\n\ndoes absolutely nothing.\n\n\tgit reflog expire --expire=0 --all\n\ntruncates all the reflogs. I'm not sure if this is intended or not.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"55179","messageId":"4709F805.8050704@op5.se","threadId":"10181","inReplyTo":"20071008010648.GB29433@potapov","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2007-10-08T09:27:33Z","receivedAt":"2007-10-08T09:27:33Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Dmitry Potapov wrote:\n> On Sun, Oct 07, 2007 at 06:22:28PM -0600, Elijah Newren wrote:\n>> git-filter-branch --tree-filter 'rm -f testme.txt' HEAD\n>> git reset --hard\n>> rm -rf .git/refs/original/\n>> vi .git/packed-refs\n>> # Use vi to remove the line referring to refs/original...\n>> git reflog expire --all --expire-unreachable=0\n>> git gc --prune\n>>\n>> Seems like a wrapper is needed.  :-)\n> \n> Actually, I would rather not, because you rarely need to remove anything\n> immediately, and 30 days delay is reasonable time to give you a chance\n> to recover that you removed accidentally. You can reduce it by setting\n> appropriate value for gc.reflogExpireUnreachable in your configuration.\n> The only thing you need to do is to remove .git/refs/original/heads/something\n> after you are sure that git-filter-branch did exactly what you wanted.\n> \n>>> Warning: all unreachable references will be removed!\n>> What other scenarios could lead to unreachable references?\n> \n> Any re-writing of history leads to that.\n> \n\ngit-rebase being the most common culprit, right alongside 'git commit --amend'.\n\n>> I don't\n>> know how to determine whether this is safe or not (except that these\n>> were test repositories anyway, so I don't care what happens to them).\n> \n> Git logs all your action, so even re-writing history would not be\n> so disastrous if you suddenly realized that you did something wrong.\n> The history is stored for 30 days by default. Usually, you do not\n> need to mess with Git internals like you did above. Your useless\n> files still will disappear after being unreachable for 30 days.\n> \n> OTOH, if you want to have a clean repository immediately, I believe\n> 'git clone' is a better option. After you made a local clone using\n> it, 'git gc' should remove old garbage.\n> \n\nA clone only fetches revs reachable from a ref, so pruning immediately\nafter a clone is completely pointless.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"55180","messageId":"20071008100559.GA9221@diana.vm.bytemark.co.uk","threadId":"10181","inReplyTo":"4709F805.8050704@op5.se","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-08T10:05:59Z","receivedAt":"2007-10-08T10:05:59Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-10-08 11:27:33 +0200, Andreas Ericsson wrote:\n\n> Dmitry Potapov wrote:\n>\n> > On Sun, Oct 07, 2007 at 06:22:28PM -0600, Elijah Newren wrote:\n> >\n> > > What other scenarios could lead to unreachable references?\n> >\n> > Any re-writing of history leads to that.\n>\n> git-rebase being the most common culprit, right alongside 'git\n> commit --amend'.\n\nStGit (and presumably guilt, and any other similar tool) are just\nglorified rebase wrappers, so they'll generate tons of unreachable\nobjects too.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"55184","messageId":"20071008124017.GA22129@potapov","threadId":"10181","inReplyTo":"4709F805.8050704@op5.se","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Dmitry Potapov","fromEmail":"dpotapov@gmail.com","sentAt":"2007-10-08T12:40:17Z","receivedAt":"2007-10-08T12:40:17Z","isPatch":false,"sender":{"key":"dpotapov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6568595?v=4"},"body":"On Mon, Oct 08, 2007 at 11:27:33AM +0200, Andreas Ericsson wrote:\n> Dmitry Potapov wrote:\n> >OTOH, if you want to have a clean repository immediately, I believe\n> >'git clone' is a better option. After you made a local clone using\n> >it, 'git gc' should remove old garbage.\n> >\n> \n> A clone only fetches revs reachable from a ref, so pruning immediately\n> after a clone is completely pointless.\n\nNot true. git-clone copies the whole pack, so it can contain unreachable\nobjects. Here is a simple script that demonstrates that without garbage\ncollection the size of the cloned repository will be the same as the\noriginal one.\n\n===========================================\n# Make a small repo\nmkdir test\ncd test\ngit init\necho hi > there\ngit add there\ngit commit -m 'Small repo'\n\n# Add a random 10M binary file\ndd if=/dev/urandom of=testme.txt count=10 bs=1M\ngit add testme.txt\ngit commit -m 'Add big binary file'\n\n# Remove the 10M binary file\ngit rm testme.txt\ngit commit -m 'Remove big binary file'\n\n# Compress the repo, see how big the repo is\ngit gc --aggressive --prune\ndu -ks .                       # 10348\ndu -ks .git                    # 10344\n\ngit-whatchanged\n\n# Try to rewrite history to remove the binary file\ngit-filter-branch --tree-filter 'rm -f testme.txt' HEAD\ngit reset --hard\n\n# Remove original refs\nrm .git/refs/original/refs/heads/master\n\n# Remove back\ncd ..\n\n# Clone repository\ngit-clone -l test/.git test2\n\ncd test2\ndu -ks .git # 10360\n\n# Now run garbage collection\ngit gc\ndu -ks .git # 96\n\n===========================================\n\nDmitry\n"},{"id":"55186","messageId":"20071008130106.GA10784@diana.vm.bytemark.co.uk","threadId":"10181","inReplyTo":"20071008124017.GA22129@potapov","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-08T13:01:06Z","receivedAt":"2007-10-08T13:01:06Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-10-08 16:40:17 +0400, Dmitry Potapov wrote:\n\n> On Mon, Oct 08, 2007 at 11:27:33AM +0200, Andreas Ericsson wrote:\n>\n> > A clone only fetches revs reachable from a ref, so pruning\n> > immediately after a clone is completely pointless.\n>\n> Not true. git-clone copies the whole pack, so it can contain\n> unreachable objects.\n[...]\n> git-clone -l test/.git test2\n\nTry without the -l option and with a file:// URL:\n\n  git clone file:///path/to/test/.git test2\n\nFrom the git-clone man page:\n\n--local::\n-l::\n        When the repository to clone from is on a local machine, this\n        flag bypasses normal \"git aware\" transport mechanism and\n        clones the repository by making a copy of HEAD and everything\n        under objects and refs directories. The files under\n        `.git/objects/` directory are hardlinked to save space when\n        possible. This is now the default when the source repository\n        is specified with `/path/to/repo` syntax, so it essentially is\n        a no-op option. To force copying instead of hardlinking (which\n        may be desirable if you are trying to make a back-up of your\n        repository), but still avoid the usual \"git aware\" transport\n        mechanism, `--no-hardlinks` can be used.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"55194","messageId":"20071008143650.GC2902@fieldses.org","threadId":"10181","inReplyTo":"4709CCB2.4000202@viscovery.net","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2007-10-08T14:36:50Z","receivedAt":"2007-10-08T14:36:50Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"On Mon, Oct 08, 2007 at 08:22:42AM +0200, Johannes Sixt wrote:\n> Johannes Schindelin schrieb:\n>> The rationale was this: filter-branch recently learnt how to rewrite many \n>> branches, and it might be tedious to find out which ones.  But then, there \n>> is git log --no-walk --all, so maybe I really should get rid of \n>> refs/original/*?\n>> I'd like to have some comments from the heavier filter-branch users on \n>> that...\n>\n> IMHO, a backup of the original refs is needed.\n\nAnd we can't rely instead on reflogs or some other existing mechanism?\n\n> However, it may be wise to store them in the refs/heads namespace so\n> that 'git branch -d' can delete them and 'git branch -m' can move them\n> back if something went wrong.\n\nIf people want backups like this it'd seem easier to turn this on\noptionally with commandline switches, like patch's --backup, --prefix,\n--suffix options.\n\nHaving it by default leave these backups around, even when everything\nsucceeds, makes for unnecessary cleanup work in the normal case, and is\ninconsistent with the behavior of other git commands that destroy or\nrewrite history.\n\n--b.\n"},{"id":"55197","messageId":"20071008163701.GA5868@thunk.org","threadId":"10181","inReplyTo":"20071008143650.GC2902@fieldses.org","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Theodore Tso","fromEmail":"tytso@mit.edu","sentAt":"2007-10-08T16:37:01Z","receivedAt":"2007-10-08T16:37:01Z","isPatch":false,"sender":{"key":"tytso@mit.edu","avatar":"https://avatars.githubusercontent.com/u/51416?v=4"},"body":"On Mon, Oct 08, 2007 at 10:36:50AM -0400, J. Bruce Fields wrote:\n> Having it by default leave these backups around, even when everything\n> succeeds, makes for unnecessary cleanup work in the normal case, and is\n> inconsistent with the behavior of other git commands that destroy or\n> rewrite history.\n\nI think what makes git-filter-branch different is that you can change\na large amount of history with git-filter-branch, including large\nnumbers of tags, etc.  The reflog is quite sufficient to recover from\na screwed up \"git commit --amend\".  But I don't think the reflog is\ngoing to be sufficient given the kinds of changes that\ngit-filter-branch can potentially do to your repository.  Maybe\ndefault of --backup vs --no-backup could be changed via a config\nparameter, but I think the default is of backing up refs is a good\nthink....\n\nPerhaps a solution would be to add \"git-filter-branch --cleanup\" that\nthat clears the reflog and wipes the backed up tags; perhaps first\nasking interactively if the user is really sure he/she wants to do\nthis.\n\n\t\t\t\t\t\t- Ted\n"},{"id":"55203","messageId":"20071008190514.GM2902@fieldses.org","threadId":"10181","inReplyTo":"20071008163701.GA5868@thunk.org","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2007-10-08T19:05:14Z","receivedAt":"2007-10-08T19:05:14Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"On Mon, Oct 08, 2007 at 12:37:01PM -0400, Theodore Tso wrote:\n> I think what makes git-filter-branch different is that you can change\n> a large amount of history with git-filter-branch, including large\n> numbers of tags, etc.  The reflog is quite sufficient to recover from\n> a screwed up \"git commit --amend\".  But I don't think the reflog is\n> going to be sufficient given the kinds of changes that\n> git-filter-branch can potentially do to your repository.  Maybe\n> default of --backup vs --no-backup could be changed via a config\n> parameter, but I think the default is of backing up refs is a good\n> think....\n\nYeah, it's clearly designed with rewriting a whole repo in mind.\n\nIt might also be handy, though, as a quick way to rewrite a single\nbranch.  (E.g., \"add 'Acked-by: Joe' to everything in 'for-upstream' not\nin 'origin'\", or \"rename foo to bar in every commit in 'topic' not in\n'origin'\".).\n\nI find the current defaults awkward for that case.  Maybe it'd make\nsense to treat the two cases differently.\n\n> Perhaps a solution would be to add \"git-filter-branch --cleanup\" that\n> that clears the reflog and wipes the backed up tags; perhaps first\n> asking interactively if the user is really sure he/she wants to do\n> this.\n\nMaybe.\n\n--b.\n"},{"id":"55250","messageId":"Pine.LNX.4.64.0710091133580.4174@racer.site","threadId":"10181","inReplyTo":"20071008163701.GA5868@thunk.org","subject":"Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-10-09T10:37:26Z","receivedAt":"2007-10-09T10:37:26Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 8 Oct 2007, Theodore Tso wrote:\n\n> On Mon, Oct 08, 2007 at 10:36:50AM -0400, J. Bruce Fields wrote:\n> > Having it by default leave these backups around, even when everything\n> > succeeds, makes for unnecessary cleanup work in the normal case, and is\n> > inconsistent with the behavior of other git commands that destroy or\n> > rewrite history.\n> \n> I think what makes git-filter-branch different is that you can change a \n> large amount of history with git-filter-branch, including large numbers \n> of tags, etc.  The reflog is quite sufficient to recover from a screwed \n> up \"git commit --amend\".\n>\n> [...]\n>\n> But I don't think the reflog is going to be sufficient given the kinds \n> of changes that git-filter-branch can potentially do to your repository.\n\nFWIW after reading Bruce's reasoning, I tend towards having no \"backups\" \nby default (I say \"backups\", since they are _only_ written when the \nrespective branch has changed).\n\nAnd I do not think that the config variable is a good approach; if you \nwant backups or not is a per-case decision.  So your proposal would only \nresult in even more confusion.\n\nMy preference ATM is to write nothing per default, but only when \n--original <namespace> was given.\n\nCiao,\nDscho\n"}]}