{"thread":{"id":"16167","subject":"More help needed on merging unrelated repos","startedAt":"2008-11-04T13:14:51Z","lastAt":"2008-11-06T15:28:43Z","messageCount":8,"participants":["Christian MICHON","Andreas Ericsson","Karl Hasselström"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"94890","messageId":"46d6db660811040514qc6c9663u17bd231e1ba662ad@mail.gmail.com","threadId":"16167","inReplyTo":null,"subject":"More help needed on merging unrelated repos","fromName":"Christian MICHON","fromEmail":"christian.michon@gmail.com","sentAt":"2008-11-04T13:14:51Z","receivedAt":"2008-11-04T13:14:51Z","isPatch":false,"sender":{"key":"christian.michon@gmail.com","avatar":"https://gravatar.com/avatar/8a7c327b21187fbcab5c27640a49450eec72e0355dc292501197f27a5a744ec4?d=mp&s=160"},"body":"Hi,\n\nI previously posted here a question on how to merge unrelated repos,\nand I was quite happy with the answer.\ngit pull repo_name repo_branch\n\nYet, when I merge these repos (they're unrelated), I'd like to merge\nall of them at once.\n\nHow do I pull for example 2 repos in 1 command ? I cannot figure out\nthe exact syntax to use.\n\nI tried:\ngit pull ../i1 0.5 ../i2 master\ngit pull ../i1 0.5 -- ../i2 master\n\nI also tried to play with --no-commit and -s to no avail.\n\nDoes anyone of you already use this and knows the trick ? Thanks in advance!\n\n-- \nChristian\n--\nhttp://detaolb.sourceforge.net/, a linux distribution for Qemu with Git inside !\n"},{"id":"94917","messageId":"4910ACCA.7080007@op5.se","threadId":"16167","inReplyTo":"46d6db660811040514qc6c9663u17bd231e1ba662ad@mail.gmail.com","subject":"Re: More help needed on merging unrelated repos","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-11-04T20:12:58Z","receivedAt":"2008-11-04T20:12:58Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Christian MICHON wrote:\n> Hi,\n> \n> I previously posted here a question on how to merge unrelated repos,\n> and I was quite happy with the answer.\n> git pull repo_name repo_branch\n> \n> Yet, when I merge these repos (they're unrelated), I'd like to merge\n> all of them at once.\n> \n> How do I pull for example 2 repos in 1 command ? I cannot figure out\n> the exact syntax to use.\n> \n> I tried:\n> git pull ../i1 0.5 ../i2 master\n> git pull ../i1 0.5 -- ../i2 master\n> \n> I also tried to play with --no-commit and -s to no avail.\n> \n> Does anyone of you already use this and knows the trick ? Thanks in advance!\n> \n\nYou can only pull from a single repository at a time. The first way of doing\nwhat you want that comes to mind is:\n\n  git remote add lib1 lib1url\n  git remote add lib2 lib2url\n  git fetch lib1 && git fetch lib2 && git merge lib1/master lib2/master\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"94920","messageId":"46d6db660811041308o19f1131dm4d49b6703fa6d22b@mail.gmail.com","threadId":"16167","inReplyTo":"4910ACCA.7080007@op5.se","subject":"Re: More help needed on merging unrelated repos","fromName":"Christian MICHON","fromEmail":"christian.michon@gmail.com","sentAt":"2008-11-04T21:08:52Z","receivedAt":"2008-11-04T21:08:52Z","isPatch":false,"sender":{"key":"christian.michon@gmail.com","avatar":"https://gravatar.com/avatar/8a7c327b21187fbcab5c27640a49450eec72e0355dc292501197f27a5a744ec4?d=mp&s=160"},"body":"Andreas Ericsson wrote:\n> Christian MICHON wrote:\n>>\n>> Hi,\n>>\n>> I previously posted here a question on how to merge unrelated repos,\n>> and I was quite happy with the answer.\n>> git pull repo_name repo_branch\n>>\n>> Yet, when I merge these repos (they're unrelated), I'd like to merge\n>> all of them at once.\n>>\n>> How do I pull for example 2 repos in 1 command ? I cannot figure out\n>> the exact syntax to use.\n>>\n>> I tried:\n>> git pull ../i1 0.5 ../i2 master\n>> git pull ../i1 0.5 -- ../i2 master\n>>\n>> I also tried to play with --no-commit and -s to no avail.\n>>\n>> Does anyone of you already use this and knows the trick ? Thanks in\n>> advance!\n>>\n>\n> You can only pull from a single repository at a time. The first way of doing\n> what you want that comes to mind is:\n>\n>  git remote add lib1 lib1url\n>  git remote add lib2 lib2url\n>  git fetch lib1 && git fetch lib2 && git merge lib1/master lib2/master\n>\n> --\n> Andreas Ericsson                   andreas.ericsson@op5.se\n> OP5 AB                             www.op5.se\n> Tel: +46 8-230225                  Fax: +46 8-230231\n>\n\nand apparently this strategy (which I tried before too :( ) fails when merging.\n\nexample:\nrepo i1 contains file 'a'\nrepo i2 contains file 'b'\nnew repo z contains file 'readme' and I want to pull repo i1 and i2 at\nthe same time inside repo z.\n\ntypically, I've to pull 1 repo at a time, if I use pull. If I fetch\nboth without merge, and then I try a merge, it fails.\nmaybe I'm on a wild goose chase after all.\n\nthanks\n-- \nChristian\n--\nhttp://detaolb.sourceforge.net/, a linux distribution for Qemu with Git inside !\n"},{"id":"94922","messageId":"4910C6F4.5010407@op5.se","threadId":"16167","inReplyTo":"46d6db660811041308o19f1131dm4d49b6703fa6d22b@mail.gmail.com","subject":"Re: More help needed on merging unrelated repos","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-11-04T22:04:36Z","receivedAt":"2008-11-04T22:04:36Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Christian MICHON wrote:\n> Andreas Ericsson wrote:\n>> Christian MICHON wrote:\n>>> Hi,\n>>>\n>>> I previously posted here a question on how to merge unrelated repos,\n>>> and I was quite happy with the answer.\n>>> git pull repo_name repo_branch\n>>>\n>>> Yet, when I merge these repos (they're unrelated), I'd like to merge\n>>> all of them at once.\n>>>\n>>> How do I pull for example 2 repos in 1 command ? I cannot figure out\n>>> the exact syntax to use.\n>>>\n>>> I tried:\n>>> git pull ../i1 0.5 ../i2 master\n>>> git pull ../i1 0.5 -- ../i2 master\n>>>\n>>> I also tried to play with --no-commit and -s to no avail.\n>>>\n>>> Does anyone of you already use this and knows the trick ? Thanks in\n>>> advance!\n>>>\n>> You can only pull from a single repository at a time. The first way of doing\n>> what you want that comes to mind is:\n>>\n>>  git remote add lib1 lib1url\n>>  git remote add lib2 lib2url\n>>  git fetch lib1 && git fetch lib2 && git merge lib1/master lib2/master\n>>\n>> --\n>> Andreas Ericsson                   andreas.ericsson@op5.se\n>> OP5 AB                             www.op5.se\n>> Tel: +46 8-230225                  Fax: +46 8-230231\n>>\n> \n> and apparently this strategy (which I tried before too :( ) fails when merging.\n> \n> example:\n> repo i1 contains file 'a'\n> repo i2 contains file 'b'\n> new repo z contains file 'readme' and I want to pull repo i1 and i2 at\n> the same time inside repo z.\n> \n> typically, I've to pull 1 repo at a time, if I use pull. If I fetch\n> both without merge, and then I try a merge, it fails.\n> maybe I'm on a wild goose chase after all.\n> \n\nAh, right. Octopus merge always does merge head reduction, but to do\nthat it needs to find a common ancestor. When no such ancestor exists,\nit will fail (with a message like \"shouldn't be doing octopus merge\"?).\n\nIf there's no \"--no-reduce-heads\" option to \"git merge\", I think you're\nscrewed with getting that to happen in a single commit.\n\nOh wait.\n\ngit merge i1 && git merge --no-commit i2 && git commit --amend\n\nmight work. I'm still shooting from the hip though, and now it's far too\nlate for me to think more. gl though.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"94923","messageId":"46d6db660811041430l74d9a100kc15ac46dea8ff63f@mail.gmail.com","threadId":"16167","inReplyTo":"4910C6F4.5010407@op5.se","subject":"Re: More help needed on merging unrelated repos","fromName":"Christian MICHON","fromEmail":"christian.michon@gmail.com","sentAt":"2008-11-04T22:30:56Z","receivedAt":"2008-11-04T22:30:56Z","isPatch":false,"sender":{"key":"christian.michon@gmail.com","avatar":"https://gravatar.com/avatar/8a7c327b21187fbcab5c27640a49450eec72e0355dc292501197f27a5a744ec4?d=mp&s=160"},"body":"On Tue, Nov 4, 2008 at 11:04 PM, Andreas Ericsson <ae@op5.se> wrote:\n> Ah, right. Octopus merge always does merge head reduction, but to do\n> that it needs to find a common ancestor. When no such ancestor exists,\n> it will fail (with a message like \"shouldn't be doing octopus merge\"?).\n>\n> If there's no \"--no-reduce-heads\" option to \"git merge\", I think you're\n> screwed with getting that to happen in a single commit.\n\n:(\n\n>\n> Oh wait.\n>\n> git merge i1 && git merge --no-commit i2 && git commit --amend\n>\n> might work. I'm still shooting from the hip though, and now it's far too\n> late for me to think more. gl though.\n>\n\nit's late for me too!\n\n$ git merge i1/master\nMerge made by recursive.\n a |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 a\n\n$ git merge --no-commit i2/master\nAutomatic merge went well; stopped before committing as requested\n\n$ git commit --amend\nfatal: You are in the middle of a merge -- cannot amend.\n\nnote the merge can work, but it's still done in 2 steps. :(\nthanks for suggesting this.\n\n-- \nChristian\n--\nhttp://detaolb.sourceforge.net/, a linux distribution for Qemu with Git inside !\n"},{"id":"95033","messageId":"20081106083751.GA10359@diana.vm.bytemark.co.uk","threadId":"16167","inReplyTo":"46d6db660811041430l74d9a100kc15ac46dea8ff63f@mail.gmail.com","subject":"Re: More help needed on merging unrelated repos","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-11-06T08:37:51Z","receivedAt":"2008-11-06T08:37:51Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-11-04 23:30:56 +0100, Christian MICHON wrote:\n\n> note the merge can work, but it's still done in 2 steps. :(\n> thanks for suggesting this.\n\nIf it had worked, you'd have gotten just one merge commit. What you\nwant to do is entirely possible, but it seems the high-level commands\nwere not designed with your use-case in mind.\n\nAnother thing you could try is to merge the two branches separately,\ngetting a history like this:\n\n  p1----\\\n         \\\n  p2---A--B\n      /\n  p3--\n\nAnd then use grafts to convince git that B has parents p1, p2, and p3\n(instead of its actual parents p1 and A). (Grep for \"graft\" in the\nDocumentation directory.)\n\nAnd then use git-filter-branch to rewrite history so that the grafted\nhistory becomes the real history.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"95044","messageId":"46d6db660811060413q7f4e2437maa6d87a27b8704b@mail.gmail.com","threadId":"16167","inReplyTo":"20081106083751.GA10359@diana.vm.bytemark.co.uk","subject":"Re: More help needed on merging unrelated repos","fromName":"Christian MICHON","fromEmail":"christian.michon@gmail.com","sentAt":"2008-11-06T12:13:42Z","receivedAt":"2008-11-06T12:13:42Z","isPatch":false,"sender":{"key":"christian.michon@gmail.com","avatar":"https://gravatar.com/avatar/8a7c327b21187fbcab5c27640a49450eec72e0355dc292501197f27a5a744ec4?d=mp&s=160"},"body":"On Thu, Nov 6, 2008 at 9:37 AM, Karl Hasselström <kha@treskal.com> wrote:\n> On 2008-11-04 23:30:56 +0100, Christian MICHON wrote:\n>\n>> note the merge can work, but it's still done in 2 steps. :(\n>> thanks for suggesting this.\n>\n> If it had worked, you'd have gotten just one merge commit. What you\n> want to do is entirely possible, but it seems the high-level commands\n> were not designed with your use-case in mind.\n>\n> Another thing you could try is to merge the two branches separately,\n> getting a history like this:\n>\n>  p1----\\\n>         \\\n>  p2---A--B\n>      /\n>  p3--\n>\n> And then use grafts to convince git that B has parents p1, p2, and p3\n> (instead of its actual parents p1 and A). (Grep for \"graft\" in the\n> Documentation directory.)\n>\n> And then use git-filter-branch to rewrite history so that the grafted\n> history becomes the real history.\n>\n> --\n> Karl Hasselström, kha@treskal.com\n>      www.treskal.com/kalle\n>\n\nnice suggestion Karl! it took a while to understand all the\nconsequences and workflow.\nOn top of your suggestion, I had to remove the\nrefs/original/refs/heads/master and the grafts file.\n\nIt worked well: quite a spell, but an efficient one. Kudo++\n\n-- \nChristian\n--\nhttp://detaolb.sourceforge.net/, a linux distribution for Qemu with Git inside !\n"},{"id":"95054","messageId":"20081106152843.GA16238@diana.vm.bytemark.co.uk","threadId":"16167","inReplyTo":"46d6db660811060413q7f4e2437maa6d87a27b8704b@mail.gmail.com","subject":"Re: More help needed on merging unrelated repos","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2008-11-06T15:28:43Z","receivedAt":"2008-11-06T15:28:43Z","isPatch":false,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2008-11-06 13:13:42 +0100, Christian MICHON wrote:\n\n> nice suggestion Karl! it took a while to understand all the\n> consequences and workflow. On top of your suggestion, I had to\n> remove the refs/original/refs/heads/master and the grafts file.\n\nI've never tried to use git-filter-branch, so I was deliberately\nvague. I was hoping you would be the enterprising type who would\nfigure out the details anyway ... ;-)\n\n> It worked well: quite a spell, but an efficient one. Kudo++\n\nWell, that's Git for you. Once you get the (really simple) underlying\ndata model you know what _can_ be done, even if it's not always\nobvious _how_ to do it.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"}]}