{"thread":{"id":"35242","subject":"Re: collapsing old git history to reduce repo size, while preserving commit #s and tags","startedAt":"2013-10-29T22:42:56Z","lastAt":"2013-10-30T16:06:08Z","messageCount":5,"participants":["Stas Cherkassky","Andrew Ardill","Jakub Narębski","Duy Nguyen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"229748","messageId":"CAJSXqrqz3KeiPKWz6rFKb4o0F88o9=63Sv37MJSp5qmYtod-6A@mail.gmail.com","threadId":"35242","inReplyTo":"CAJSXqrr4nA6azBgaD7rBbYSLWonQkn7PvSsPTXjAPaxW6E+LiA@mail.gmail.com","subject":"Re: collapsing old git history to reduce repo size, while preserving commit #s and tags","fromName":"Stas Cherkassky","fromEmail":"scherkas@gmail.com","sentAt":"2013-10-29T22:42:56Z","receivedAt":"2013-10-29T22:42:56Z","isPatch":false,"sender":{"key":"scherkas@gmail.com","avatar":null},"body":"Hi,\n\nI have an old git repo with e.g. 1000 commits, that grew up to\nconsiderable size.\nNow, I am starting a new project and want to use this repo, but \"slimmed down\".\n\nI'd like to clone the repo to the new project and \"slim it down\"\nI'd like to collapse 900 first commits into one, but keep last 100,\nwith their commit numbers and tags. I also want to be able to push and\nmerge changes from the old repo to the new one.\n\nI've read about git rebase, but it seems to tamper with commit numbers\nand looses tags.. Is there any other way to have it done ?\n\nthanks!!\n"},{"id":"229749","messageId":"CAH5451=DGp0aRaA6c-ThO0Aj0VCAUFX17p8gOKPpURwEnjcpdA@mail.gmail.com","threadId":"35242","inReplyTo":"CAJSXqrqz3KeiPKWz6rFKb4o0F88o9=63Sv37MJSp5qmYtod-6A@mail.gmail.com","subject":"Re: collapsing old git history to reduce repo size, while preserving commit #s and tags","fromName":"Andrew Ardill","fromEmail":"andrew.ardill@gmail.com","sentAt":"2013-10-29T22:52:12Z","receivedAt":"2013-10-29T22:52:12Z","isPatch":false,"sender":{"key":"andrew.ardill@gmail.com","avatar":"https://gravatar.com/avatar/da14cb7c091dd44dc6c63a4d3361b149acaf25226dc78eb4131a17b93d9b0993?d=mp&s=160"},"body":"On 29 October 2013 15:42, Stas Cherkassky <scherkas@gmail.com> wrote:\n> I'd like to clone the repo to the new project and \"slim it down\"\n> I'd like to collapse 900 first commits into one, but keep last 100,\n> with their commit numbers and tags. I also want to be able to push and\n> merge changes from the old repo to the new one.\n\nIf you want to change the actual history of your repository, it will\nbe largely incompatible with the original, and this is by design. You\ndon't want somebody being able to change your history without you\nknowing about it.\n\n> I've read about git rebase, but it seems to tamper with commit numbers\n> and looses tags.. Is there any other way to have it done ?\n\nIt sounds like a shallow checkout might be appropriate for you, try\nlooking that up.\n\nRegards,\n\nAndrew Ardill\n"},{"id":"229794","messageId":"CAJSXqrrMCWmRBoRNCLuD6DvU=CSk+MVGrSOCeOROROEaKouVKQ@mail.gmail.com","threadId":"35242","inReplyTo":"CAJSXqrr7rHxyXX=_+xgJ4FW2UHSts2jRt7zwrkkw1L3uKHnCtw@mail.gmail.com","subject":"Re: collapsing old git history to reduce repo size, while preserving commit #s and tags","fromName":"Stas Cherkassky","fromEmail":"scherkas@gmail.com","sentAt":"2013-10-30T07:52:19Z","receivedAt":"2013-10-30T07:52:19Z","isPatch":false,"sender":{"key":"scherkas@gmail.com","avatar":null},"body":"Andrew,\n\nShallow clone (if that's what you meant) is not suitable because it\ndoesn't allow to push/pull to/from this shallow repository.\n\nI understand that generally git is designed to preserve the history.\nBut the problem is real,  and probably is not unique to our project.\nThe fact that there ARE some ways to modify history (collapse commits,\nrebase, filter-branch) made me hopeful that what I need is also\npossible..\n\nthanks,\nStas\n"},{"id":"229822","messageId":"52712BF2.2080409@gmail.com","threadId":"35242","inReplyTo":"CAJSXqrrMCWmRBoRNCLuD6DvU=CSk+MVGrSOCeOROROEaKouVKQ@mail.gmail.com","subject":"Re: collapsing old git history to reduce repo size, while preserving commit #s and tags","fromName":"Jakub Narębski","fromEmail":"jnareb@gmail.com","sentAt":"2013-10-30T15:55:30Z","receivedAt":"2013-10-30T15:55:30Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On 2013-10-30 08:52, Stas Cherkassky wrote:\n>\n> Shallow clone (if that's what you meant) is not suitable because it\n> doesn't allow to push/pull to/from this shallow repository.\n\nStill?  I think there were some work on making shallow clone to\nallowing push/pull to/from it.\n\n> I understand that generally git is designed to preserve the history.\n> But the problem is real,  and probably is not unique to our project.\n> The fact that there ARE some ways to modify history (collapse commits,\n> rebase, filter-branch) made me hopeful that what I need is also\n> possible..\n\nBy the very nature of git, namely that the 'parent' link to previous\n(as in: this is based on it) commit or commits, is SHA-1 of said commit,\nand SHA-1 identifier of commit is based on contents including 'parent'\nfield.\n\nBoth rebase and filter-branch _rewrite_ history (i.e. make modified\ncopy of history, and let you replace old history by new).\n\nYou could try to use father or shallow clone, namely *grafts*, to\n'cauterize' history, but there remains same problems as with shallow\nclone, perhaps with exception that git won't check things for you.\n\n-- \nJakub Narębski\n"},{"id":"229825","messageId":"CACsJy8BcJMTeyku-37v5pwVvYFixaP2sLMQ24WaerKf8C9-AAw@mail.gmail.com","threadId":"35242","inReplyTo":"52712BF2.2080409@gmail.com","subject":"Re: collapsing old git history to reduce repo size, while preserving commit #s and tags","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-10-30T16:06:08Z","receivedAt":"2013-10-30T16:06:08Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Wed, Oct 30, 2013 at 10:55 PM, Jakub Narębski <jnareb@gmail.com> wrote:\n> On 2013-10-30 08:52, Stas Cherkassky wrote:\n>>\n>>\n>> Shallow clone (if that's what you meant) is not suitable because it\n>> doesn't allow to push/pull to/from this shallow repository.\n>\n>\n> Still?  I think there were some work on making shallow clone to\n> allowing push/pull to/from it.\n\nYes, still :-) I've got a proof of concept, but it needs more work to\naddress the concern about its automatically turning a full repo into a\nshallow one.\n-- \nDuy\n"}]}