git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: More help needed on merging unrelated repos

From
Andreas Ericsson <ae@op5.se>
Date
Nov 4, 2008, 22:04 UTC
Message-ID
<4910C6F4.5010407@op5.se>
In-Reply-To
<46d6db660811041308o19f1131dm4d49b6703fa6d22b@mail.gmail.com>
Christian MICHON wrote:
Show 48 quoted lines
> Andreas Ericsson wrote:
>> Christian MICHON wrote:
>>> Hi,
>>>
>>> I previously posted here a question on how to merge unrelated repos,
>>> and I was quite happy with the answer.
>>> git pull repo_name repo_branch
>>>
>>> Yet, when I merge these repos (they're unrelated), I'd like to merge
>>> all of them at once.
>>>
>>> How do I pull for example 2 repos in 1 command ? I cannot figure out
>>> the exact syntax to use.
>>>
>>> I tried:
>>> git pull ../i1 0.5 ../i2 master
>>> git pull ../i1 0.5 -- ../i2 master
>>>
>>> I also tried to play with --no-commit and -s to no avail.
>>>
>>> Does anyone of you already use this and knows the trick ? Thanks in
>>> advance!
>>>
>> You can only pull from a single repository at a time. The first way of doing
>> what you want that comes to mind is:
>>
>>  git remote add lib1 lib1url
>>  git remote add lib2 lib2url
>>  git fetch lib1 && git fetch lib2 && git merge lib1/master lib2/master
>>
>> --
>> Andreas Ericsson                   andreas.ericsson@op5.se
>> OP5 AB                             www.op5.se
>> Tel: +46 8-230225                  Fax: +46 8-230231
>>
> 
> and apparently this strategy (which I tried before too :( ) fails when merging.
> 
> example:
> repo i1 contains file 'a'
> repo i2 contains file 'b'
> new repo z contains file 'readme' and I want to pull repo i1 and i2 at
> the same time inside repo z.
> 
> typically, I've to pull 1 repo at a time, if I use pull. If I fetch
> both without merge, and then I try a merge, it fails.
> maybe I'm on a wild goose chase after all.
> 

Ah, right. Octopus merge always does merge head reduction, but to do that it needs to find a common ancestor. When no such ancestor exists, it will fail (with a message like "shouldn't be doing octopus merge"?).

If there's no "--no-reduce-heads" option to "git merge", I think you're screwed with getting that to happen in a single commit.

Oh wait.
git merge i1 && git merge --no-commit i2 && git commit --amend

might work. I'm still shooting from the hip though, and now it's far too late for me to think more. gl though.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Previous: Christian MICHONNext: Christian MICHON
Message 4 of 8 in “More help needed on merging unrelated repos”
  1. Christian MICHONNov 4, 2008
  2. Andreas EricssonNov 4, 2008
  3. Christian MICHONNov 4, 2008
  4. Andreas EricssonNov 4, 2008
  5. Christian MICHONNov 4, 2008
  6. Karl HasselströmNov 6, 2008
  7. Christian MICHONNov 6, 2008
  8. Karl HasselströmNov 6, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.