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

Git: Question about specific subtree usage

From
TATHILLOSEN Andreas <thillosen@free.fr>
Date
Jan 12, 2014, 00:23 UTC
Message-ID
<52D1E07C.1010403@free.fr>
Hi,

I have a question about a specific use case for subtrees, but I'm not sure if is really possible (hence my e-mail, because all my tests failed so far...)

>From what I have read, subtrees are used mainly to:
- Import inside a working git repository, other git repositories... it's
a little like a symbolic link pointing to another git repository, but
without the burden (it will be the main working git repository that will
handle the unified history);
- Merge many repositories into a single one (after that, they will be
seen as directories linked to the same history);
- Conversely, dispatch branches in a single repository, to make them
distinct repositories;
And now, here is my use case...

I have a big project, which contains many components (each one having, for the moment, its own directory and repository): MainLibrary/ MainLibrary-Tests/ Frontend1/ Frontend1-Tests/ Frontend2/ Frontend2-Tests/

MainLibrary contains the heart of the application; all other components are linked to it when compiling. For testing purpose, it must be possible to synchronize each component independently (checking out MainLibrary at a specific tag level, and checking out MainLibrary-Tests at another commit level for instance). This is the important point... Each component must have its own history line, and I must be able to check it out freely and independently from the other components.

Here would be my dream... Each component would be managed by a subtree, but ensure that:

- Components are not be tied to a same common branch... but I'm not sure
if it is possible to manage distinct history lines within a same git
history; after creating orphan branches, it becomes impossible to run
most operations like "check out");
- Any new developer would need only one basic operation to get the full
working material: clone one repo, and it's done (it would be awesome,
because in reality, my project is even bigger than my example). It would
spare us many scripting operations...
- Each component can be checked out at any desired level, and so we get
the sources of multiple components simultaneously (so far, using
subtrees or submodules, I had always the same trouble: I could only get
the sources of one component, which was the last I checked out or
activated).

Having a big shared history for all components may slow down some operations, but it won't be a big problem for the scope of our project. So... is my use case possible using git-magic? (I hinted subtrees, but maybe there are better ways?) Or must I keep my current methodology (one independant repository per components... so each new developer must clones zillions of things at the right place...)

Greetings,
Andreas THILLOSEN.
Next: Torsten Bögershausen
Message 1 of 3 in “Git: Question about specific subtree usage”
  1. THILLOSEN AndreasJan 12, 2014
  2. Torsten BögershausenJan 12, 2014
  3. THILLOSEN AndreasJan 12, 2014

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.