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

Re: Subtree merging of sub-directories between repositories?

From
Avery Pennarun <apenwarr@gmail.com>
Date
Aug 2, 2009, 18:53 UTC
Message-ID
<32541b130908021153j28872a34v84dccfdfbc99b607@mail.gmail.com>
In-Reply-To
<2729632a0908021105m10bfb8ddx700464d06fd38023@mail.gmail.com>
On Sun, Aug 2, 2009 at 2:05 PM, <skillzero@gmail.com> wrote:
Show 9 quoted lines
> On Sun, Aug 2, 2009 at 1:30 AM, Avery Pennarun<apenwarr@gmail.com> wrote:
>> 2) Use "git subtree split" to take the subdir of A and give it a
>> history of its own, then merge that history into a subdir of B (using
>> "git subtree add" or any other subtree merge method you want to use).
>> You can then git subtree split/merge back and forth between A and B in
>> the future to copy future changes from one to the other.
>
> Thanks for the help. I tried #2 and it sort of worked. The history was
> imported, but the resulting paths were flattened. Here's what I did:
[...]
Show 12 quoted lines
> The full history doesn't seem to be associated with that directory. If
> I do 'git log --name-only --topo-order', I see the full history, but
> the files are listed as:
>
> file.c
>
> and I was expecting to see:
>
> X/Y/C/file.c
>
> Because I'd want to be able to do 'git log X/Y/C' and see all the
> commits that affect that directory.

Yeah, this is a tricky one. Git has all the necessary information to "know" that the files were "moved" from file.c (in the subtree project history) to X/Y/C.file.c (in your superproject). But "git log" doesn't use this information for anything at the moment, and "--follow" doesn't seem to make it work.

Since I don't have the required skills or knowledge to fix git's history following, my hope is that this will magically start working in a future version of git because someone like you gets annoyed with it :)

Have fun,
Avery
Previous: skillzero@gmail.com
Message 4 of 4 in “Subtree merging of sub-directories between repositories?”
  1. skillzero@gmail.comAug 2, 2009
  2. Avery PennarunAug 2, 2009
  3. skillzero@gmail.comAug 2, 2009
  4. Avery PennarunAug 2, 2009

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.