{"thread":{"id":"8080","subject":"Repo cleanup problem","startedAt":"2007-05-11T08:03:32Z","lastAt":"2007-05-11T09:32:13Z","messageCount":4,"participants":["Eugine Kosenko","Matthieu Moy","Karl Hasselström"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"41817","messageId":"9909dee80705110103h5b848490m296c001beecfa1f1@mail.gmail.com","threadId":"8080","inReplyTo":null,"subject":"Repo cleanup problem","fromName":"Eugine Kosenko","fromEmail":"eugine.kosenko@gmail.com","sentAt":"2007-05-11T08:03:32Z","receivedAt":"2007-05-11T08:03:32Z","isPatch":false,"sender":{"key":"eugine.kosenko@gmail.com","avatar":null},"body":"I'm sorry, if it is a FAQ.\n\nI use git to track my own changes in a project, i.e, this is a private\n(not public) repository. Some time ago I've accidentally committed a\nbig amount (about of 50M) of crap into the repository, and make a\nmature set of commits after this.\n\nFor now I'm looking for a way to remove the garbage commit. I've found\na way to remove any commit using git-checkout, git-reset and\ngit-rebase. But, when I even git-reset the repository to the very\nfirst (root) commit, I see the size is still large enough, i.e., the\ncrap is still there. I've tried many combinations of git-gc,\ngit-prune, git-repack, git-prune-packed etc, but the size of the\nrepository is still the same. The only way I see now is to git-clone\nthe repository -- the new one is essentially smaller, but needs to\nreconstruct the local branches.\n\nIs this (make a clone) the only proper way to clenup a repository, or\nthere is another magic tool to cleanup the repositories?\n"},{"id":"41818","messageId":"vpqveezhjb0.fsf@bauges.imag.fr","threadId":"8080","inReplyTo":"9909dee80705110103h5b848490m296c001beecfa1f1@mail.gmail.com","subject":"Re: Repo cleanup problem","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-05-11T08:10:43Z","receivedAt":"2007-05-11T08:10:43Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\"Eugine Kosenko\" <eugine.kosenko@gmail.com> writes:\n\n> For now I'm looking for a way to remove the garbage commit.\n\nBranch before the garbage commit. Then, you can use git-rebase to\nreplay the correct history on top of your new branch. Note that\ngit-rebase will break merging if you already used merge: it does not\n\"move\" your old commits to your new branch, it instead creates new\ncommits with the same changes at the old ones, in the new branch.\n\nThat's probably what you've done already.\n\nThen, to have git-gc remove the old, bad, history, you need to remove\nany reference you have to it: branches and tags. git-branch -d and\nperhaps git-tag -d will tell you.\n\nSee also git-fsck that can point you to dangling objects, which should\nthen be removed by git-gc.\n\ngitk --all, on the other hand, will show you the commits to which you\nhave a reference (and their ancestry).\n\n-- \nMatthieu\n"},{"id":"41819","messageId":"20070511081906.GA21093@diana.vm.bytemark.co.uk","threadId":"8080","inReplyTo":"vpqveezhjb0.fsf@bauges.imag.fr","subject":"Re: Repo cleanup problem","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-05-11T08:19:06Z","receivedAt":"2007-05-11T08:19:06Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-05-11 10:10:43 +0200, Matthieu Moy wrote:\n\n> Then, to have git-gc remove the old, bad, history, you need to remove\n> any reference you have to it: branches and tags. git-branch -d and\n> perhaps git-tag -d will tell you.\n\nThe reflog is on by default nowadays, which essentially means that\ndangling commits won't be pruned for 30 days or something -- unless\nyou delete the references in the reflog as well. \"git reflog expire\"\ncan probably help here.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"41823","messageId":"9909dee80705110232m5ef56517i542728ef8657971e@mail.gmail.com","threadId":"8080","inReplyTo":"vpqveezhjb0.fsf@bauges.imag.fr","subject":"Re: Repo cleanup problem","fromName":"Eugine Kosenko","fromEmail":"eugine.kosenko@gmail.com","sentAt":"2007-05-11T09:32:13Z","receivedAt":"2007-05-11T09:32:13Z","isPatch":false,"sender":{"key":"eugine.kosenko@gmail.com","avatar":null},"body":"2007/5/11, Matthieu Moy <Matthieu.Moy@imag.fr>:\n> Branch before the garbage commit. Then, you can use git-rebase to\n> replay the correct history on top of your new branch. Note that\n> git-rebase will break merging if you already used merge: it does not\n> \"move\" your old commits to your new branch, it instead creates new\n> commits with the same changes at the old ones, in the new branch.\n>\n> That's probably what you've done already.\n\nAlmost that. Unfortunately, this simple way causes unexpected\nconflicts, so I need also to do sometimes 'git-checkout <tag> .' and\nrecommit the changes to force the process.\n"}]}