{"thread":{"id":"30116","subject":"Purging old history","startedAt":"2012-03-31T04:25:08Z","lastAt":"2012-03-31T20:20:23Z","messageCount":4,"participants":["John M. Dlugosz","Ramkumar Ramachandra","Jakub Narebski","Phil Hord"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"188230","messageId":"17650-1333167969-40275@sneakemail.com","threadId":"30116","inReplyTo":null,"subject":"Purging old history","fromName":"John M. Dlugosz","fromEmail":"ngnr63q02@sneakemail.com","sentAt":"2012-03-31T04:25:08Z","receivedAt":"2012-03-31T04:25:08Z","isPatch":false,"sender":{"key":"ngnr63q02@sneakemail.com","avatar":null},"body":"Is there a simple way to delete old commits, say beyond a certain age, before putting it \non the server?  The ancient stuff is not relevant and there are a lot of binaries.  Some \nusers may have trouble with an extensive download when syncing the first time.\n\n—John\n"},{"id":"188231","messageId":"CALkWK0=mcQR3CBMpa5P1f+JwqNMqUs3D4=tVPx4c_4R+TXCKbw@mail.gmail.com","threadId":"30116","inReplyTo":"17650-1333167969-40275@sneakemail.com","subject":"Re: Purging old history","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2012-03-31T04:43:43Z","receivedAt":"2012-03-31T04:43:43Z","isPatch":false,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi John,\n\nJohn M. Dlugosz wrote:\n> Is there a simple way to delete old commits, say beyond a certain age,\n> before putting it on the server?  The ancient stuff is not relevant and\n> there are a lot of binaries.  Some users may have trouble with an extensive\n> download when syncing the first time.\n\nYes, although your terminology is wrong: it's not about \"deleting\"\ncommits; simply create a fresh root commit and rebase your work on top\nof it.  As an example, let's say you want to squash history from the\n67afe1 (the old root) to 7ef42b on the master branch:\n\n$ git checkout -b newroot 7ef42b\n$ git reset 67afe1\n$ git add .\n$ git commit --amend\n$ git checkout master\n$ git rebase --onto newroot 7ef42b\n\n    Ram\n"},{"id":"188236","messageId":"m37gy1b2j0.fsf@localhost.localdomain","threadId":"30116","inReplyTo":"CALkWK0=mcQR3CBMpa5P1f+JwqNMqUs3D4=tVPx4c_4R+TXCKbw@mail.gmail.com","subject":"Re: Purging old history","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2012-03-31T08:25:27Z","receivedAt":"2012-03-31T08:25:27Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Ramkumar Ramachandra <artagnon@gmail.com> writes:\n> John M. Dlugosz wrote:\n\n> > Is there a simple way to delete old commits, say beyond a certain age,\n> > before putting it on the server?  The ancient stuff is not relevant and\n> > there are a lot of binaries.  Some users may have trouble with an extensive\n> > download when syncing the first time.\n\nIt seems that you have XY problem.\n\nOne solution to extensive initial download is to create a git-bundle\nof all commits up to e.g. some tag, and host it using HTTP, FTP\n(which are resumable), or even P2P like BitTorrent.\n \nAnother solution would be to educate users to use shallow clones,\ni.e. use \"--depth\" option to git-clone... and help git developers make\nshallow clones better (there are some unncessary limitations in using\nshallow clones).\n\n> Yes, although your terminology is wrong: it's not about \"deleting\"\n> commits; simply create a fresh root commit and rebase your work on top\n> of it.  As an example, let's say you want to squash history from the\n> 67afe1 (the old root) to 7ef42b on the master branch:\n> \n> $ git checkout -b newroot 7ef42b\n> $ git reset 67afe1\n> $ git add .\n> $ git commit --amend\n> $ git checkout master\n> $ git rebase --onto newroot 7ef42b\n\nA simpler solution, one that would work also in presence of merges, is\nto use grafts mechanism (see gitrepository-layout(5)) to cauterize\nhistory, check using git-log or gitk that shortened history is\ncorrect, make grafts permanent altering history with\ngit-filter-branch, and finally removing grafts.\n\nP.S. Please read first all the warnings about rewriting history, and\nabout all its disadvantages for downstream.\n\n-- \nJakub Narebski\n"},{"id":"188261","messageId":"CABURp0oYJOYvxK54A7e3J2N1V-0pDS_AAoRErXhg6pJ6ZW962Q@mail.gmail.com","threadId":"30116","inReplyTo":"17650-1333167969-40275@sneakemail.com","subject":"Re: Purging old history","fromName":"Phil Hord","fromEmail":"phil.hord@gmail.com","sentAt":"2012-03-31T20:20:23Z","receivedAt":"2012-03-31T20:20:23Z","isPatch":false,"sender":{"key":"phil.hord@gmail.com","avatar":"https://avatars.githubusercontent.com/u/123908?v=4"},"body":"On Sat, Mar 31, 2012 at 12:25 AM, John M. Dlugosz\n<ngnr63q02@sneakemail.com> wrote:\n> Is there a simple way to delete old commits, say beyond a certain age,\n> before putting it on the server?  The ancient stuff is not relevant and\n> there are a lot of binaries.  Some users may have trouble with an extensive\n> download when syncing the first time.\n\nYou may also choose to absolve the old commits of past sins (binaries\nand secrets) while keeping them in the history.  See 'git help\nfilter-branch' for the manual and some pertinent examples.\n\nPhil\n"}]}