{"thread":{"id":"27553","subject":"500Mb file erroneously commited","startedAt":"2011-06-06T07:43:20Z","lastAt":"2011-06-06T09:10:16Z","messageCount":4,"participants":["Bartolomeo Nicolotti","Michael J Gruber","Axel Freyn","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"169343","messageId":"loom.20110606T093627-918@post.gmane.org","threadId":"27553","inReplyTo":null,"subject":"500Mb file erroneously commited","fromName":"Bartolomeo Nicolotti","fromEmail":"bnicolotti@siapcn.it","sentAt":"2011-06-06T07:43:20Z","receivedAt":"2011-06-06T07:43:20Z","isPatch":false,"sender":{"key":"bnicolotti@siapcn.it","avatar":null},"body":"Hello,\n\nwe're using CVS to store some sources, but for some big projects I'm considering\nto use git. Last week it has happened that one collegue erroneously commited one\nbig file, 500Mb the file only. To avoid to have this file in the repository\nwe've deleted the history file in the CVS repository, the one with ,v, this has\nbeen easy as each file has its own history. Would it be possible to do the same\nwith git, or there's no possibility to delete a 500Mb file erroneously commited? \n\nMany thanks\n\nBest regards\n\nBartolomeo\n"},{"id":"169344","messageId":"4DEC86EE.1030101@drmicha.warpmail.net","threadId":"27553","inReplyTo":"loom.20110606T093627-918@post.gmane.org","subject":"Re: 500Mb file erroneously commited","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-06-06T07:51:10Z","receivedAt":"2011-06-06T07:51:10Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Bartolomeo Nicolotti venit, vidit, dixit 06.06.2011 09:43:\n> Hello,\n> \n> we're using CVS to store some sources, but for some big projects I'm considering\n> to use git. Last week it has happened that one collegue erroneously commited one\n> big file, 500Mb the file only. To avoid to have this file in the repository\n> we've deleted the history file in the CVS repository, the one with ,v, this has\n> been easy as each file has its own history. Would it be possible to do the same\n> with git, or there's no possibility to delete a 500Mb file erroneously commited? \n\nDue to the way git (or hg or...) works, you would have to rewrite the\nhistory in order to remove a file from a repo completely. The first\nexample in the git-filter-branch man page describes how to do this.\n\nMichael\n"},{"id":"169345","messageId":"20110606075508.GC19127@axel","threadId":"27553","inReplyTo":"loom.20110606T093627-918@post.gmane.org","subject":"Re: 500Mb file erroneously commited","fromName":"Axel Freyn","fromEmail":"axel-freyn@gmx.de","sentAt":"2011-06-06T07:55:08Z","receivedAt":"2011-06-06T07:55:08Z","isPatch":false,"sender":{"key":"axel-freyn@gmx.de","avatar":null},"body":"On Mon, Jun 06, 2011 at 07:43:20AM +0000, Bartolomeo Nicolotti wrote:\n> Hello,\n> \n> we're using CVS to store some sources, but for some big projects I'm considering\n> to use git. Last week it has happened that one collegue erroneously commited one\n> big file, 500Mb the file only. To avoid to have this file in the repository\n> we've deleted the history file in the CVS repository, the one with ,v, this has\n> been easy as each file has its own history. Would it be possible to do the same\n> with git, or there's no possibility to delete a 500Mb file erroneously commited? \nHi,\n\nyes, you can. In fact, there are at least two situation:\n - if you detect the error DIRECTLY after the commit (and have no other\n   commits on top of it), then a\n   git rm bigfile\n   git commit --amend\n   does the trick (well, the big file will be unused now, and be deleted\n   by the next \"git gc\")\n - if you have already other commit's on top of it, you can use e.g.\n   \"git rebase\" in order to redefine the history... something like (I'm\n   not sure it works exactly like that, but in principle)\n   git checkout -b tmp <WRONG_COMMIT>\n   git rm bigfile\n   git commit --amend\n   git checkout master\n   git rebase tmpfix\n   git branch -d tmpfix\n\n   \nHowever, there if your tree has been already shared with other\ndevelopers, they also will have to change to the new and corrected\nbranch.\n\nAxel\n"},{"id":"169347","messageId":"vpq62oj2umf.fsf@bauges.imag.fr","threadId":"27553","inReplyTo":"20110606075508.GC19127@axel","subject":"Re: 500Mb file erroneously commited","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2011-06-06T09:10:16Z","receivedAt":"2011-06-06T09:10:16Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Axel Freyn <axel-freyn@gmx.de> writes:\n\n>  - if you have already other commit's on top of it, you can use e.g.\n>    \"git rebase\" in order to redefine the history... something like (I'm\n>    not sure it works exactly like that, but in principle)\n>    git checkout -b tmp <WRONG_COMMIT>\n>    git rm bigfile\n>    git commit --amend\n>    git checkout master\n>    git rebase tmpfix\n>    git branch -d tmpfix\n\nThat should work, but \"git rebase -i\" will make it much simpler (just\n\"edit\" or even delete the guilty commit).\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}