{"thread":{"id":"15072","subject":"Merging repositories and their histories","startedAt":"2008-08-18T16:46:14Z","lastAt":"2008-08-22T12:19:14Z","messageCount":8,"participants":["Peter Waller","Alex Riesen","Marcus Griep"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"87549","messageId":"19035412.post@talk.nabble.com","threadId":"15072","inReplyTo":null,"subject":"Merging repositories and their histories","fromName":"Peter Waller","fromEmail":"peter.waller@gmail.com","sentAt":"2008-08-18T16:46:14Z","receivedAt":"2008-08-18T16:46:14Z","isPatch":false,"sender":{"key":"peter.waller@gmail.com","avatar":"https://gravatar.com/avatar/c1588c5f6518d6678b34658d1fc3b321fb69c9680f630291d14a3021a4b739d5?d=mp&s=160"},"body":"\nI have three repositories, A, B and C. I wish to bring them together to only\none repository (.), where they are in a directory called ./Archive, so..\n./Archive/{A,B,C}. Then I plan at a later date to move files arbitrarily\nfrom ./Archive/{A/B/C}/Something and into ./Something{A/B/C}. (A lame\nexample, but illustrates what I want to do).\n\nI would like ./SomethingA (etc) to have their complete histories from the\nold repository. I thought I would do this with the subtree mechanism\ndescribed at\nhttp://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html,\nbut I have had little luck getting it to work as I desired.\n\nFirstly, I create a new repository with git init, then I \"remote add A\",\n\"merge\" and \"readtree\". This immediately leads to two copies of A's files,\nin ./Archive/A/Files and ./Files. The files in Archive/A do not have any\nhistory.\n\nThen if I do this with B, the files do not appear in ./, but again they do\nnot have their history. I have tried using git log --follow -M, but this\ndoes not seem to help. I have tried numerous other ways of doing this, but\nnone seem to work.\n\nI thought I would get around my problems doing the merge, then moving the\nfiles - this works for A, but when I move on to B, the files are not in ./,\nso I can't move them. If I read-tree some files, git status/commit shows\nthem as 'new files' and does not seem to recognize them as old files with a\nlong history.\n\nAny help would be appreciated on this problem.\n\nThanks in advance,\n\n- Peter\n-- \nView this message in context: http://www.nabble.com/Merging-repositories-and-their-histories-tp19035412p19035412.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"87553","messageId":"20080818173511.GC6014@blimp.local","threadId":"15072","inReplyTo":"19035412.post@talk.nabble.com","subject":"Re: Merging repositories and their histories","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-08-18T17:35:11Z","receivedAt":"2008-08-18T17:35:11Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Peter Waller, Mon, Aug 18, 2008 18:46:14 +0200:\n> \n> I have three repositories, A, B and C. I wish to bring them together to only\n> one repository (.), where they are in a directory called ./Archive, so..\n> ./Archive/{A,B,C}. Then I plan at a later date to move files arbitrarily\n> from ./Archive/{A/B/C}/Something and into ./Something{A/B/C}. (A lame\n> example, but illustrates what I want to do).\n\nIf this transition is meant to be persistent (IOW, the A, B and C stop\nexisting as repos on their own) you can rewrite their histories to be\nin the directories (with git filter-branch) and just merge them in\none. Then the histories will look like as if they have never grown\nseparately.\n"},{"id":"87555","messageId":"d3d284ca0808181116t26e2eac3u5b8da4a8f5a91b65@mail.gmail.com","threadId":"15072","inReplyTo":"20080818173511.GC6014@blimp.local","subject":"Re: Merging repositories and their histories","fromName":"Peter Waller","fromEmail":"peter.waller@gmail.com","sentAt":"2008-08-18T18:16:47Z","receivedAt":"2008-08-18T18:16:47Z","isPatch":false,"sender":{"key":"peter.waller@gmail.com","avatar":"https://gravatar.com/avatar/c1588c5f6518d6678b34658d1fc3b321fb69c9680f630291d14a3021a4b739d5?d=mp&s=160"},"body":"I don't quite understand what you are suggesting I do.\n\nI have looked over the filter-branch manpage.\n\nWhat would I first do? Copy all three repositories to\n./Archive/{A,B,C}? Then rewrite their histories?\n\n- Peter\n\n2008/8/18 Alex Riesen <raa.lkml@gmail.com>\n>\n> Peter Waller, Mon, Aug 18, 2008 18:46:14 +0200:\n> >\n> > I have three repositories, A, B and C. I wish to bring them together to only\n> > one repository (.), where they are in a directory called ./Archive, so..\n> > ./Archive/{A,B,C}. Then I plan at a later date to move files arbitrarily\n> > from ./Archive/{A/B/C}/Something and into ./Something{A/B/C}. (A lame\n> > example, but illustrates what I want to do).\n>\n> If this transition is meant to be persistent (IOW, the A, B and C stop\n> existing as repos on their own) you can rewrite their histories to be\n> in the directories (with git filter-branch) and just merge them in\n> one. Then the histories will look like as if they have never grown\n> separately.\n>\n"},{"id":"87559","messageId":"20080818194021.GA3262@steel.home","threadId":"15072","inReplyTo":"d3d284ca0808181115j2c9ab5ecufb66780f45d28207@mail.gmail.com","subject":"Re: Merging repositories and their histories","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-08-18T19:40:21Z","receivedAt":"2008-08-18T19:40:21Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Peter Waller, Mon, Aug 18, 2008 20:15:52 +0200:\n> 2008/8/18 Alex Riesen <raa.lkml@gmail.com>\n> \n> > Peter Waller, Mon, Aug 18, 2008 18:46:14 +0200:\n> > >\n> > > I have three repositories, A, B and C. I wish to bring them\n> > > together to only one repository (.), where they are in a\n> > > directory called ./Archive, so..  ./Archive/{A,B,C}. Then I plan\n> > > at a later date to move files arbitrarily from\n> > > ./Archive/{A/B/C}/Something and into ./Something{A/B/C}. (A lame\n> > > example, but illustrates what I want to do).\n> >\n> > If this transition is meant to be persistent (IOW, the A, B and C stop\n> > existing as repos on their own) you can rewrite their histories to be\n> > in the directories (with git filter-branch) and just merge them in\n> > one. Then the histories will look like as if they have never grown\n> > separately.\n> >\n> I don't quite understand what you are suggesting I do.\n> \n> I have looked over the filter-branch manpage.\n> \n> What would I first do? Copy all three repositories to ./Archive/{A,B,C}?\n\nFetch, actually.\n\n    $ mkdir combined && cd combined\n    $ git init\n    $ git fetch ../A master:A\n    $ git fetch ../B master:B\n    $ git fetch ../C master:C\n\n> Then rewrite their histories?\n\nThere is an example at the end of git-filter-branch manpage. Search\nfor \"To move the whole tree into a subdirectory\". Just use A, B and C\ninstead of HEAD as last argument.\n\nThen checkout one of the new, the rewritten, branches, and merge the\ntwo others into it:\n\n    $ git checkout A\n    $ git merge B\n    $ git merge C\n\nThat's it.\n"},{"id":"87574","messageId":"d3d284ca0808181425v4e0eadbcn9f00f5a15191576@mail.gmail.com","threadId":"15072","inReplyTo":"20080818194021.GA3262@steel.home","subject":"Re: Merging repositories and their histories","fromName":"Peter Waller","fromEmail":"peter.waller@gmail.com","sentAt":"2008-08-18T21:25:54Z","receivedAt":"2008-08-18T21:25:54Z","isPatch":false,"sender":{"key":"peter.waller@gmail.com","avatar":"https://gravatar.com/avatar/c1588c5f6518d6678b34658d1fc3b321fb69c9680f630291d14a3021a4b739d5?d=mp&s=160"},"body":"Thanks, it worked.\n\n2008/8/18 Alex Riesen <raa.lkml@gmail.com>:\n> Peter Waller, Mon, Aug 18, 2008 20:15:52 +0200:\n>> 2008/8/18 Alex Riesen <raa.lkml@gmail.com>\n>>\n>> > Peter Waller, Mon, Aug 18, 2008 18:46:14 +0200:\n>> > >\n>> > > I have three repositories, A, B and C. I wish to bring them\n>> > > together to only one repository (.), where they are in a\n>> > > directory called ./Archive, so..  ./Archive/{A,B,C}. Then I plan\n>> > > at a later date to move files arbitrarily from\n>> > > ./Archive/{A/B/C}/Something and into ./Something{A/B/C}. (A lame\n>> > > example, but illustrates what I want to do).\n>> >\n>> > If this transition is meant to be persistent (IOW, the A, B and C stop\n>> > existing as repos on their own) you can rewrite their histories to be\n>> > in the directories (with git filter-branch) and just merge them in\n>> > one. Then the histories will look like as if they have never grown\n>> > separately.\n>> >\n>> I don't quite understand what you are suggesting I do.\n>>\n>> I have looked over the filter-branch manpage.\n>>\n>> What would I first do? Copy all three repositories to ./Archive/{A,B,C}?\n>\n> Fetch, actually.\n>\n>    $ mkdir combined && cd combined\n>    $ git init\n>    $ git fetch ../A master:A\n>    $ git fetch ../B master:B\n>    $ git fetch ../C master:C\n>\n>> Then rewrite their histories?\n>\n> There is an example at the end of git-filter-branch manpage. Search\n> for \"To move the whole tree into a subdirectory\". Just use A, B and C\n> instead of HEAD as last argument.\n>\n> Then checkout one of the new, the rewritten, branches, and merge the\n> two others into it:\n>\n>    $ git checkout A\n>    $ git merge B\n>    $ git merge C\n>\n> That's it.\n>\n"},{"id":"88048","messageId":"48ADE2A6.2020407@gmail.com","threadId":"15072","inReplyTo":"19035412.post@talk.nabble.com","subject":"Re: Merging repositories and their histories","fromName":"Marcus Griep","fromEmail":"neoeinstein@gmail.com","sentAt":"2008-08-21T21:48:22Z","receivedAt":"2008-08-21T21:48:22Z","isPatch":false,"sender":{"key":"neoeinstein@gmail.com","avatar":"https://gravatar.com/avatar/75d467077b37e56699d408fb97545e9a92a2907ff1feea4ba3a4b861f7cb7af4?d=mp&s=160"},"body":"Peter Waller wrote:\n> I have three repositories, A, B and C. I wish to bring them together to only\n> one repository (.), where they are in a directory called ./Archive, so..\n> ./Archive/{A,B,C}. Then I plan at a later date to move files arbitrarily\n> from ./Archive/{A/B/C}/Something and into ./Something{A/B/C}. (A lame\n> example, but illustrates what I want to do).\n\nPeter Waller also wrote:\n> Thanks, it worked.\n> \n> 2008/8/18 Alex Riesen <raa.lkml@gmail.com>:\n> > > Peter Waller, Mon, Aug 18, 2008 20:15:52 +0200:\n> >> >> 2008/8/18 Alex Riesen <raa.lkml@gmail.com>\n> >> >>\n> >>> >> > Peter Waller, Mon, Aug 18, 2008 18:46:14 +0200:\n> >>>> >> > >\n> >>>> >> > > (The same thing as above)\n\nDid it actually not work?\n\n-- \nMarcus Griep\nGPG Key ID: 0x5E968152\n——\nhttp://www.boohaunt.net\nאת.ψο´\n\n"},{"id":"88050","messageId":"d3d284ca0808211453r2e1f1f1ak5e0a0b1ea7329a2@mail.gmail.com","threadId":"15072","inReplyTo":"48ADE2A6.2020407@gmail.com","subject":"Re: Merging repositories and their histories","fromName":"Peter Waller","fromEmail":"peter.waller@gmail.com","sentAt":"2008-08-21T21:53:51Z","receivedAt":"2008-08-21T21:53:51Z","isPatch":false,"sender":{"key":"peter.waller@gmail.com","avatar":"https://gravatar.com/avatar/c1588c5f6518d6678b34658d1fc3b321fb69c9680f630291d14a3021a4b739d5?d=mp&s=160"},"body":"Nabble kept telling me that my post was not submitted, which I found\nvery confusing, so I ended up trying to resubmit the post. Sorry for\nthe spam. This is now sorted.\n\nCheers for the keen-ness to help! :-)\n\n- Pete\n\n2008/8/21 Marcus Griep <neoeinstein@gmail.com>\n>\n> Peter Waller wrote:\n> > I have three repositories, A, B and C. I wish to bring them together to only\n> > one repository (.), where they are in a directory called ./Archive, so..\n> > ./Archive/{A,B,C}. Then I plan at a later date to move files arbitrarily\n> > from ./Archive/{A/B/C}/Something and into ./Something{A/B/C}. (A lame\n> > example, but illustrates what I want to do).\n>\n> Peter Waller also wrote:\n> > Thanks, it worked.\n> >\n> > 2008/8/18 Alex Riesen <raa.lkml@gmail.com>:\n> > > > Peter Waller, Mon, Aug 18, 2008 20:15:52 +0200:\n> > >> >> 2008/8/18 Alex Riesen <raa.lkml@gmail.com>\n> > >> >>\n> > >>> >> > Peter Waller, Mon, Aug 18, 2008 18:46:14 +0200:\n> > >>>> >> > >\n> > >>>> >> > > (The same thing as above)\n>\n> Did it actually not work?\n>\n> --\n> Marcus Griep\n> GPG Key ID: 0x5E968152\n> ——\n> http://www.boohaunt.net\n> את.ψο´\n>\n"},{"id":"88118","messageId":"81b0412b0808220519p7ad1c994y405ddf33ade12896@mail.gmail.com","threadId":"15072","inReplyTo":"48ADE2A6.2020407@gmail.com","subject":"Re: Merging repositories and their histories","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-08-22T12:19:14Z","receivedAt":"2008-08-22T12:19:14Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"2008/8/21 Marcus Griep <neoeinstein@gmail.com>:\n>> 2008/8/18 Alex Riesen <raa.lkml@gmail.com>:\n>> > > Peter Waller, Mon, Aug 18, 2008 20:15:52 +0200:\n>> >> >> 2008/8/18 Alex Riesen <raa.lkml@gmail.com>\n>> >> >>\n>> >>> >> > Peter Waller, Mon, Aug 18, 2008 18:46:14 +0200:\n>> >>>> >> > >\n>> >>>> >> > > (The same thing as above)\n>\n> Did it actually not work?\n>\n\nWhy not?\n"}]}