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

Re: Can I Insert some Ancient History into a repo?

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Dec 2, 2020, 15:50 UTC
Message-ID
<87o8jcus0m.fsf@evledraar.gmail.com>
In-Reply-To
<AM0PR02MB40811C5C2E8B13B63D06E4B49CF30@AM0PR02MB4081.eurprd02.prod.outlook.com>
On Wed, Dec 02 2020, Kerry, Richard wrote:
Show 7 quoted lines
> I've read up on merging repositories and I can easily get L1 into the
> same repo as L2, as a separate line of development.  However, merging
> it is not the right thing to do, as that leaves me with L1 and L2
> having separate starting points, with a merge leading to there being
> only one head.  That's the opposite of what I want - I want to keep
> one starting point (that of L1), and branch L2 off it (with L2 ending
> up as master).

I've brought in existing repos into other repos like what you describe you shouldn't be doing, "git merge --allow-unrelated-histories" exists for a reason, you can just use it.

I do think you're starting from the wrong starting point though, maybe not in your thinking, but your post just says you want to combine these, and how to do it.

The reason I've done this in the past is for some practical reason. E.g. you might want to arrange it so a "git blame" or "git log" on a file traverses down the right path & history, or to be able to refer to commits by SHA1.

Depending on what you actually want to with the end result merging or using grafts might not be the best thing to do. E.g. a perfectly OK thing in some cases is to just have a side-repo somewhere to keep the old history, you can add it as a remote to do some ad-hoc inspection, but never need to push a merger of the two to the current active repo.

Previous: Johannes SchindelinNext: Kerry, Richard
Message 3 of 5 in “Can I Insert some Ancient History into a repo?”
  1. Kerry, RichardDec 2, 2020
  2. Johannes SchindelinDec 2, 2020
  3. Ævar Arnfjörð BjarmasonDec 2, 2020
  4. Kerry, RichardMar 12, 2021
  5. Kerry, RichardMar 13, 2021

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.