{"thread":{"id":"16575","subject":"Is there a way to control the number of revisions will be saved by git","startedAt":"2008-12-03T11:01:10Z","lastAt":"2008-12-03T18:23:38Z","messageCount":9,"participants":["Tzury Bar Yochay","Johannes Sixt","Arafangion","Jakub Narebski","Jean-Luc Herren","Miklos Vajna"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"97046","messageId":"2f5ea7490812030301p29e944fw5f59943dc352cd09@mail.gmail.com","threadId":"16575","inReplyTo":null,"subject":"Is there a way to control the number of revisions will be saved by git","fromName":"Tzury Bar Yochay","fromEmail":"tzury.by@gmail.com","sentAt":"2008-12-03T11:01:10Z","receivedAt":"2008-12-03T11:01:10Z","isPatch":false,"sender":{"key":"tzury.by@gmail.com","avatar":"https://gravatar.com/avatar/ecb65c541914786a10dfbaa4c55b4b5f3541792cf90529c8080feb065bf54523?d=mp&s=160"},"body":"Hello Happy Gitters,\n\nSay I wish to save only 100 generations back (per branch).\nIs it possible to configure git so it will save only N records back.\n\nIf git cannot be configured for that, Is there a way to shrink the repository\nmanually so it will contain the last N generations?\n\n\n- Tzury\n"},{"id":"97050","messageId":"49366C03.5080506@viscovery.net","threadId":"16575","inReplyTo":"2f5ea7490812030301p29e944fw5f59943dc352cd09@mail.gmail.com","subject":"Re: Is there a way to control the number of revisions will be saved by git","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-12-03T11:22:43Z","receivedAt":"2008-12-03T11:22:43Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Tzury Bar Yochay schrieb:\n> Hello Happy Gitters,\n> \n> Say I wish to save only 100 generations back (per branch).\n> Is it possible to configure git so it will save only N records back.\n\nNo.\n\n> If git cannot be configured for that, Is there a way to shrink the repository\n> manually so it will contain the last N generations?\n\nYes:\n\n  $ git rev-parse HEAD~$N >> .git/info/grafts\n  $ git filter-branch HEAD\n\nThis assumes that your history is strictly linear and you do not have\ntags. It also rewrites the $N commits so that they now have different\nSHA1s. For this reason, don't share this repository with anyone - it leads\nto confusion.\n\n-- Hannes\n"},{"id":"97051","messageId":"1228304226.23167.8.camel@therock.nsw.bigpond.net.au","threadId":"16575","inReplyTo":"2f5ea7490812030301p29e944fw5f59943dc352cd09@mail.gmail.com","subject":"Re: Is there a way to control the number of revisions will be saved by git","fromName":"Arafangion","fromEmail":"thestar@fussycoder.id.au","sentAt":"2008-12-03T11:37:06Z","receivedAt":"2008-12-03T11:37:06Z","isPatch":false,"sender":{"key":"thestar@fussycoder.id.au","avatar":null},"body":"On Wed, 2008-12-03 at 13:01 +0200, Tzury Bar Yochay wrote:\n<snip>\n> Say I wish to save only 100 generations back (per branch).\n> Is it possible to configure git so it will save only N records back.\n\nWhat would be the advantage in doing that?  Git is designed so that you\nhave all your history available, and saves data in such a way that it\nreally doesn't take much space.\n\nHow would git be able to perform a merge from one branch to another if\nit didn't have this history available?\n\nThat said, you could probably chop off the history you don't want by\ndoing tricks with grafting, and rewriting all your history, but this\nwould likely use more disk space because your branches wouldn't have\nanything in common, and also make it very difficult to merge in the\nfuture.\n"},{"id":"97054","messageId":"2f5ea7490812030447s1239cb19n7a266bc2d00e01dc@mail.gmail.com","threadId":"16575","inReplyTo":"2f5ea7490812030301p29e944fw5f59943dc352cd09@mail.gmail.com","subject":"Re: Is there a way to control the number of revisions will be saved by git","fromName":"Tzury Bar Yochay","fromEmail":"tzury.by@gmail.com","sentAt":"2008-12-03T12:47:38Z","receivedAt":"2008-12-03T12:47:38Z","isPatch":false,"sender":{"key":"tzury.by@gmail.com","avatar":"https://gravatar.com/avatar/ecb65c541914786a10dfbaa4c55b4b5f3541792cf90529c8080feb065bf54523?d=mp&s=160"},"body":"Thanks for your answers.\n\nlove git\n"},{"id":"97055","messageId":"m3ljuxifer.fsf@localhost.localdomain","threadId":"16575","inReplyTo":"49366C03.5080506@viscovery.net","subject":"Re: Is there a way to control the number of revisions will be saved by git","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-12-03T12:58:40Z","receivedAt":"2008-12-03T12:58:40Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n> Tzury Bar Yochay schrieb:\n\n> > Say I wish to save only 100 generations back (per branch).\n> > Is it possible to configure git so it will save only N records back.\n\nWhy would you want that, by the way?\n\n> No.\n> \n> > If git cannot be configured for that, Is there a way to shrink the\n> > repository manually so it will contain the last N generations?\n> \n> Yes:\n> \n>   $ git rev-parse HEAD~$N >> .git/info/grafts\n>   $ git filter-branch HEAD\n> \n> This assumes that your history is strictly linear and you do not have\n> tags. It also rewrites the $N commits so that they now have different\n> SHA1s. For this reason, don't share this repository with anyone - it leads\n> to confusion.\n\nOr just use shallow clone\n\n  git clone --depth <depth> <repository>\n\nto have new copy (clone) of <repository> to have only <depth> commits\nback.  See man git-commit; but it might be not what you want.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"97057","messageId":"493683C6.8060902@gmx.ch","threadId":"16575","inReplyTo":"1228304226.23167.8.camel@therock.nsw.bigpond.net.au","subject":"Re: Is there a way to control the number of revisions will be saved by git","fromName":"Jean-Luc Herren","fromEmail":"jlh@gmx.ch","sentAt":"2008-12-03T13:04:06Z","receivedAt":"2008-12-03T13:04:06Z","isPatch":false,"sender":{"key":"jlh@gmx.ch","avatar":null},"body":"Arafangion wrote:\n> On Wed, 2008-12-03 at 13:01 +0200, Tzury Bar Yochay wrote:\n> <snip>\n>> Say I wish to save only 100 generations back (per branch).\n>> Is it possible to configure git so it will save only N records back.\n> \n> What would be the advantage in doing that?\n\nThat would be a shallow repository, as is already supported by\n\"git clone --depth 100\".  It can be useful for a number of things,\nfor example developing simple patches on top of HEAD and sending\nthem somewhere.\n\nWhat the OP might want is a way to convert a full repository into\na shallow one (can be done by cloning and deleting the original),\nand then be able to make it shallower from time to time, to limit\nit to 100 revisions; not sure if that is possible.\n\njlh\n"},{"id":"97066","messageId":"20081203134036.GR19355@genesis.frugalware.org","threadId":"16575","inReplyTo":"m3ljuxifer.fsf@localhost.localdomain","subject":"Re: Is there a way to control the number of revisions will be saved by git","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2008-12-03T13:40:37Z","receivedAt":"2008-12-03T13:40:37Z","isPatch":false,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Wed, Dec 03, 2008 at 04:58:40AM -0800, Jakub Narebski <jnareb@gmail.com> wrote:\n> Or just use shallow clone\n> \n>   git clone --depth <depth> <repository>\n> \n> to have new copy (clone) of <repository> to have only <depth> commits\n> back.  See man git-commit; but it might be not what you want.\n\nYou mean man git-clone?\n\nThis trick can be used only once, since you can't clone a shallow clone.\n"},{"id":"97082","messageId":"2f5ea7490812031020l57ec1a04x257c66549f3dac8a@mail.gmail.com","threadId":"16575","inReplyTo":"2f5ea7490812030301p29e944fw5f59943dc352cd09@mail.gmail.com","subject":"Re: Is there a way to control the number of revisions will be saved by git","fromName":"Tzury Bar Yochay","fromEmail":"tzury.by@gmail.com","sentAt":"2008-12-03T18:20:14Z","receivedAt":"2008-12-03T18:20:14Z","isPatch":false,"sender":{"key":"tzury.by@gmail.com","avatar":"https://gravatar.com/avatar/ecb65c541914786a10dfbaa4c55b4b5f3541792cf90529c8080feb065bf54523?d=mp&s=160"},"body":"> Why would you want that, by the way?\nI was thinking of building some experimental application on top of git\n"},{"id":"97083","messageId":"2f5ea7490812031023j6f338eb4v3f272b7d9d88fd33@mail.gmail.com","threadId":"16575","inReplyTo":"2f5ea7490812031020l57ec1a04x257c66549f3dac8a@mail.gmail.com","subject":"Re: Is there a way to control the number of revisions will be saved by git","fromName":"Tzury Bar Yochay","fromEmail":"tzury.by@gmail.com","sentAt":"2008-12-03T18:23:38Z","receivedAt":"2008-12-03T18:23:38Z","isPatch":false,"sender":{"key":"tzury.by@gmail.com","avatar":"https://gravatar.com/avatar/ecb65c541914786a10dfbaa4c55b4b5f3541792cf90529c8080feb065bf54523?d=mp&s=160"},"body":"On Wed, Dec 3, 2008 at 8:20 PM, Tzury Bar Yochay <tzury.by@gmail.com> wrote:\n>> Why would you want that, by the way?\n> I was thinking of building some experimental application on top of git\n>\n\nLooking at the numbers (of bytes). GIT's efficiency seems to redundant\nthis option which was a result of my concern about disk space usage.\n\nGIT creators are magicians!\n"}]}