threads / discuss / 35641

Git: Question about specific subtree usage

Subject: Git: Question about specific subtree usage

## tl;dr

3 messages between Jan 12, 2014 and Jan 12, 2014.

replies: 2people: 2as markdown or json

THILLOSEN Andreas· Jan 12, 2014, 00:23 UTC · lore
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.
Torsten Bögershausen· Jan 12, 2014, 10:29 UTC · re: THILLOSEN Andreas · lore

Re: Git: Question about specific subtree usage

On 2014-01-12 01.23, THILLOSEN Andreas wrote:
> Hi,
> 
> I have a question about a specific use case for subtrees, but I'm not
I feel a little bit confused: Are you talking about git submodules?

And you may want to have a look at the repo tool: https://code.google.com/p/git-repo/

HTH /Torsten

THILLOSEN Andreas· Jan 12, 2014, 12:18 UTC · re: Torsten Bögershausen · lore

Re: Git: Question about specific subtree usage

Well... submodules didn't seem to fit the job, because it seems that the sources of only one submodule at a time can be checked out. And in my case, I would need to have the sources of all submodules simultaneously. I was talking about subtrees, because I thought it could be a better tool for this job (and it had the reputation of being less cumbersome than submodules).

Maybe such a job cannot be done with pure git commands. Thanks for pointing me this "git-repo" script tool... the description seems to fit my needs! I will test it, and hope it will work on Windows (project is unfortunately very Windows-oriented, for the time being).

Thanks for you help!
Andreas THILLOSEN.
Le 01/12/14 11:29, Torsten Bögershausen a écrit :
Show 15 quoted lines
> On 2014-01-12 01.23, THILLOSEN Andreas wrote:
>> Hi,
>>
>> I have a question about a specific use case for subtrees, but I'm not
> I feel a little bit confused: Are you talking about git submodules?
>
> And you may want to have a look at the repo tool:
> https://code.google.com/p/git-repo/
>
> HTH
> /Torsten
>
>
>
>

← back to recent threads