{"thread":{"id":"7585","subject":"incorporating the past","startedAt":"2007-04-09T18:14:17Z","lastAt":"2007-04-09T19:59:10Z","messageCount":3,"participants":["Thomas Hühn","Shawn O. Pearce","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"38941","messageId":"87d52d1kli.fsf@mid.thomas-huehn.de","threadId":"7585","inReplyTo":null,"subject":"incorporating the past","fromName":"Thomas Hühn","fromEmail":"newsgroups@thomas-huehn.de","sentAt":"2007-04-09T18:14:17Z","receivedAt":"2007-04-09T18:14:17Z","isPatch":false,"sender":{"key":"newsgroups@thomas-huehn.de","avatar":null},"body":"Hi\n\nI have looked through some git tutorials and the manual, and what is\ninteresting me most right now is, how do I handle a situation like this\nwith git? It's purely speculative, I don't have such a situation in\nreality, so my description might be a bit murky...\n\nI'll try to make an extremely simple example, just one file, no\nbranching etc.\n\nI have a file under version control, that I got at the point of file\nversion 1.0. I start committing changes:\n\no--o--o--o--o--o--o\n^                 ^\ngit init,         current,\nversion 1.0       version 1.6\n\nThen I get the history up to my version 1.0 from somewhere else (former\nmaintainer, whatever). In the form of plain text files, one for each\nversion; say, versions 0.1 thru 0.9. I want to incorporate this past\ninto my tree.\n\nCan I just do another git init for 0.1, commit the changes up to 1.0 and\nmerge those two histories? Don't I need a common ancestor for both or\nsomething like that?\n\nOr can I do the same, only up to 0.9 instead of 1.0, and then \"sew\ntogether\" those histories?\n\nIs there some kind of \"add-past\", where the changed contents in the\nworking directory are prepended, not appended to the history? So that I\ncould \"prepend\" 0.9, then 0.8 and so on until 0.1?\n\nI guess, I just don't have a clear grasp of what \"history\" and \"branch\"\nand so on mean.\n\nThomas\n"},{"id":"38943","messageId":"20070409183210.GX5436@spearce.org","threadId":"7585","inReplyTo":"87d52d1kli.fsf@mid.thomas-huehn.de","subject":"Re: incorporating the past","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-04-09T18:32:10Z","receivedAt":"2007-04-09T18:32:10Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Thomas H??hn <newsgroups@thomas-huehn.de> wrote:\n> I have a file under version control, that I got at the point of file\n> version 1.0. I start committing changes:\n> \n> o--o--o--o--o--o--o\n> ^                 ^\n> git init,         current,\n> version 1.0       version 1.6\n> \n> Then I get the history up to my version 1.0 from somewhere else (former\n> maintainer, whatever). In the form of plain text files, one for each\n> version; say, versions 0.1 thru 0.9. I want to incorporate this past\n> into my tree.\n>\n> Or can I do the same, only up to 0.9 instead of 1.0, and then \"sew\n> together\" those histories?\n\nYes.  Look at the `grafts' file.  You can create a new repository\nof the 0.9..1.0 history, then graft that repository as a new parent\nof the 1.0 commit.  This lets you join in the old history behind\nthe existing history.  The Linux kernel folks have done this for\nthe kernel repository.\n\n-- \nShawn.\n"},{"id":"38959","messageId":"7vejmtz5dd.fsf@assigned-by-dhcp.cox.net","threadId":"7585","inReplyTo":"87d52d1kli.fsf@mid.thomas-huehn.de","subject":"Re: incorporating the past","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-09T19:59:10Z","receivedAt":"2007-04-09T19:59:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Hühn <newsgroups@thomas-huehn.de> writes:\n\n> Can I just do another git init for 0.1, commit the changes up to 1.0 and\n> merge those two histories? Don't I need a common ancestor for both or\n> something like that?\n>\n> Or can I do the same, only up to 0.9 instead of 1.0, and then \"sew\n> together\" those histories?\n\nYes. you can \"graft\" two distinct histories together.\n\nYou already have v1.0..v1.6 history.  You create v0.1..v0.9\nhistory the same way, perhaps in a separate repository.\n\nThen, you tell git to pretend that the v1.0, which in reality\ndoes not have any parent (i.e. \"git cat-file commit v1.0\" does\nnot have any \"parent\" line), has one parent that is v0.9, by\ncreating a file .git/info/grafts.  The file should list two\ncommit object names (v1.0 first and then v0.9) separated with a\nsingle SP and then terminated with a single LF.  Each line of\nthis file says \"this commit (the first one on the line) has the\nfollowing parents (the rest)\".\n"}]}