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

Re: git subtree as a solution to partial cloning?

From
Avery Pennarun <apenwarr@gmail.com>
Date
May 25, 2009, 15:50 UTC
Message-ID
<32541b130905250850h75f905e0t84287f897600187f@mail.gmail.com>
In-Reply-To
<8873ae500905250233t52dce5b5v8ca88b9921a88437@mail.gmail.com>
On Mon, May 25, 2009 at 5:33 AM, Asger Ottar Alstrup <asger@area9.dk> wrote:
Show 13 quoted lines
> On Mon, May 25, 2009 at 9:59 AM, Avery Pennarun <apenwarr@gmail.com> wrote:
>> On Mon, May 25, 2009 at 3:21 AM, Asger Ottar Alstrup <asger@area9.dk> wrote:
>>> Does git subtree support splitting at the file level, or only at directory
>>> level?
>>
>> Currently only at the directory level.  In theory, there's nothing
>> stopping us from working with any subset of files... but it's really
>> much simpler this way (both to code and to explain) so I'd much rather
>> leave it as is.  Can you reorganize your tree so that you divide the
>> needed files into different subdirectories?
>
> No, that is unfortunately not so easy. If we could, I suppose we could
> use submodules instead.

Your only option may be to use git filter-branch then. It lets you do pretty much anything you want, although merging it back together again could be entertaining. (Making it correctly mergeable is by far the trickiest part of git-subtree.)

> Are the subtree split and merge operations effective? I.e. how do they
> scale with the size of the original and reduced repositories? I.e. is
> it feasible to use hooks to automate the splitting and merging
> whenever there are changes in the original or reduced repositories?

git subtree manipulates only commit objects (and a reference to the single tree object representing the subtree in each commit) so it's very fast and doesn't depend on file sizes or number of files. Basically git subtree split is O(n) in the number of *commits* since the most recent split.

Have fun,
Avery
Previous: Asger Ottar AlstrupNext: Asger Ottar Alstrup
Message 3 of 8 in “Re: git subtree as a solution to partial cloning?”
  1. Avery PennarunMay 25, 2009
  2. Asger Ottar AlstrupMay 25, 2009
  3. Avery PennarunMay 25, 2009
  4. Asger Ottar AlstrupMay 25, 2009
  5. Avery PennarunMay 25, 2009
  6. Asger Ottar AlstrupMay 25, 2009
  7. Avery PennarunMay 25, 2009
  8. Jakub NarebskiMay 25, 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.