{"thread":{"id":"3403","subject":"Prepend the history of one git tree to another","startedAt":"2006-02-20T09:09:09Z","lastAt":"2006-02-20T12:51:40Z","messageCount":6,"participants":["Thomas Glanzmann","Andreas Ericsson","Ryan Anderson","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"16444","messageId":"20060220090909.GT6558@cip.informatik.uni-erlangen.de","threadId":"3403","inReplyTo":null,"subject":"Prepend the history of one git tree to another","fromName":"Thomas Glanzmann","fromEmail":"sithglan@stud.uni-erlangen.de","sentAt":"2006-02-20T09:09:09Z","receivedAt":"2006-02-20T09:09:09Z","isPatch":false,"sender":{"key":"sithglan@stud.uni-erlangen.de","avatar":null},"body":"Hello,\nI have two trees: blastwave and blastwave.old. blastwave.old is the\nBitKeeper -> CVS -> GIT Tree of the project and blastwave is the newer\none that I started when I stoped using bitkeeper. What I want is to \nappend the history of blastwave to blastwave.old. The problem is that I\nneed to create new commit objects for every commit I want to append to\nthe old history. Is there a script which does that for me? Or do I have\nto write this script myself?\n\n        Thomas\n"},{"id":"16446","messageId":"43F99684.5070403@op5.se","threadId":"3403","inReplyTo":"20060220090909.GT6558@cip.informatik.uni-erlangen.de","subject":"Re: Prepend the history of one git tree to another","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2006-02-20T10:14:28Z","receivedAt":"2006-02-20T10:14:28Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Thomas Glanzmann wrote:\n> Hello,\n> I have two trees: blastwave and blastwave.old. blastwave.old is the\n> BitKeeper -> CVS -> GIT Tree of the project and blastwave is the newer\n> one that I started when I stoped using bitkeeper. What I want is to \n> append the history of blastwave to blastwave.old. The problem is that I\n> need to create new commit objects for every commit I want to append to\n> the old history. Is there a script which does that for me? Or do I have\n> to write this script myself?\n> \n\nSomething like this might do the trick, depending on how linear your \nancestry graph is:\n\n$ cd blastwave\n$ first=$(git rev-list HEAD | tail -n 1)\n$ git format-patch -k --stdout $first..HEAD > ../blw.mbox\n$ cd ../blastwave.old\n$ git am -k -3 ../blw.mbox\n\nYMMV though, so set an anchor tag at the HEAD of blastwave.old so you \ncan return to it if things go awry. If the history is very non-linear I \nthink you'll have to do the same for each and every branch, although \nyou'd have to use \"git merge-base\" to figure out how long to go.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"16448","messageId":"20060220104345.GG26454@cip.informatik.uni-erlangen.de","threadId":"3403","inReplyTo":"43F99684.5070403@op5.se","subject":"Re: Prepend the history of one git tree to another","fromName":"Thomas Glanzmann","fromEmail":"sithglan@stud.uni-erlangen.de","sentAt":"2006-02-20T10:43:45Z","receivedAt":"2006-02-20T10:43:45Z","isPatch":false,"sender":{"key":"sithglan@stud.uni-erlangen.de","avatar":null},"body":"Hello Andreas,\n\n> Something like this might do the trick, depending on how linear your \n> ancestry graph is:\n\n> $ cd blastwave\n> $ first=$(git rev-list HEAD | tail -n 1)\n> $ git format-patch -k --stdout $first..HEAD > ../blw.mbox\n> $ cd ../blastwave.old\n> $ git am -k -3 ../blw.mbox\n\nMy graph is very linear. However. I have binaries checked into my tree.\nI am not sure if format-patch can handle this.\n\n        Thomas\n"},{"id":"16450","messageId":"43F9A0B3.6020304@michonline.com","threadId":"3403","inReplyTo":"20060220104345.GG26454@cip.informatik.uni-erlangen.de","subject":"Re: Prepend the history of one git tree to another","fromName":"Ryan Anderson","fromEmail":"ryan@michonline.com","sentAt":"2006-02-20T10:57:55Z","receivedAt":"2006-02-20T10:57:55Z","isPatch":false,"sender":{"key":"ryan@michonline.com","avatar":null},"body":"Thomas Glanzmann wrote:\n\n>Hello Andreas,\n>\n>  \n>\n>>Something like this might do the trick, depending on how linear your \n>>ancestry graph is:\n>>    \n>>\n>\n>  \n>\n>>$ cd blastwave\n>>$ first=$(git rev-list HEAD | tail -n 1)\n>>$ git format-patch -k --stdout $first..HEAD > ../blw.mbox\n>>$ cd ../blastwave.old\n>>$ git am -k -3 ../blw.mbox\n>>    \n>>\n>\n>My graph is very linear. However. I have binaries checked into my tree.\n>I am not sure if format-patch can handle this.\n>  \n>\nI wrote a program called \"graft-ripple\", that takes a commit, and\nrewrites the current branch's history to reflect as if it started at\nthat commit.\n\nIt doesn't ever actually work with diffs or anything, it just reads\ncommits and trees and recreates them.\n\nIt's in the list archives, but I appear to have deleted it when I was\ncleaning up my archives.\n\nhttp://www.gelato.unsw.edu.au/archives/git/0511/12965.html\n\nHope this helps!\n\n-- \n\nRyan Anderson\n  sometimes Pug Majere\n\n"},{"id":"16452","messageId":"20060220122052.GD5318@cip.informatik.uni-erlangen.de","threadId":"3403","inReplyTo":"43F9A0B3.6020304@michonline.com","subject":"Re: Prepend the history of one git tree to another","fromName":"Thomas Glanzmann","fromEmail":"sithglan@stud.uni-erlangen.de","sentAt":"2006-02-20T12:20:52Z","receivedAt":"2006-02-20T12:20:52Z","isPatch":false,"sender":{"key":"sithglan@stud.uni-erlangen.de","avatar":null},"body":"Hello,\n\n> I wrote a program called \"graft-ripple\", that takes a commit, and\n> rewrites the current branch's history to reflect as if it started at\n> that commit. It doesn't ever actually work with diffs or anything, it\n> just reads commits and trees and recreates them.\n\n> http://www.gelato.unsw.edu.au/archives/git/0511/12965.html\n\nthat is *exactly* what I was looking for. Thanks.\n\n> Hope this helps!\n\nWell it does!\n\nThanks,\n        Thomas\n"},{"id":"16453","messageId":"Pine.LNX.4.63.0602201350210.23862@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"3403","inReplyTo":"20060220104345.GG26454@cip.informatik.uni-erlangen.de","subject":"Re: Prepend the history of one git tree to another","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-02-20T12:51:40Z","receivedAt":"2006-02-20T12:51:40Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 20 Feb 2006, Thomas Glanzmann wrote:\n\n> Hello Andreas,\n> \n> > Something like this might do the trick, depending on how linear your \n> > ancestry graph is:\n> \n> > $ cd blastwave\n> > $ first=$(git rev-list HEAD | tail -n 1)\n> > $ git format-patch -k --stdout $first..HEAD > ../blw.mbox\n> > $ cd ../blastwave.old\n> > $ git am -k -3 ../blw.mbox\n> \n> My graph is very linear. However. I have binaries checked into my tree.\n> I am not sure if format-patch can handle this.\n\nDo you need the history at all times? If not, you could just make a graft \nfile. If you need it always, you could even check in a version of the \ngraft file (but remember to copy it to .git/info/grafts, too).\n\nHth,\nDscho\n"}]}