0

The Problem

I'm migrating a legacy CVS repo into Git, and have run into a problem with our planned strategy involving subtrees.

We're developing several different products that, in some cases, share a common library that we're also developing. I'm going to put each product in its own git repo, since they go through their own independent development lifecycles.

For using the common library, I was planning on having that in a separate repo as well, and then pulling the library into the products that need them using subtrees. Our problem is that different products will pull in different versions of the library.

I can link the subtree to a specific tag or branch, no problem, but then how do other developers know what tag/branch I used when they clone the repo and re-link the subtree?

The Example

We're developing the Guncho product in the Guncho repo.

I link it to the Filfre library against the tag v2.1 using subtree.

git subtree add --prefix=filfre ssh://stephen@gitserver:filfre v2.1

Then my co-worker Jane clones the Guncho repo to help out on it.

git clone ssh://jane@gitserver:guncho

Is there any way she can know to re-link the filfre subtree to the v2.1 tag short of me telling her?

1 Answers1

0

I'm assuming since you're working off of a tagged version of the Filfre library that Jane won't be making any changes to it. Unless Jane is going to be making changes to the Filfre library, she has no need to even know that the code in the filfre directory originally came from a different repo.

The subtree commands let git merge using a different directory structure, but once you merge that code into your master branch, it's actually all merged in to your own repo, not as a link or pointer to a different repo like happens with git submodule.

Jane doesn't need to know or care about the original source of the code. It's all part of the Guncho repo once the subtree is merged in.

Brian
  • 1
  • Unfortunately that's not true in all cases: there are times where Jane and I will need to make changes to the Filfre library. (Those times we'll be working on a branch rather than on a tagged version.) I'm also concerned about the use case where someone's tasked with updating the main Guncho project to use a newer version of our Filfre library, and would prefer if it didn't require a hunt back through history to see what version was subtree'd in. – Stephen Granade Jul 30 '14 at 13:21