threads / discuss / 7230

git support for subprojects?

Subject: git support for subprojects?

## tl;dr

3 messages between Mar 13, 2007 and Mar 14, 2007.

replies: 2people: 3as markdown or json

luke.powell@bjservices.com· Mar 13, 2007, 14:32 UTC · lore

Say that I have projects A and B which both depend on another project Z. Whenever I update one of those projects, I'd like to also update to the latest version of Z in a subdirectory. Is there that kind of support for these subprojects? If I'm not being clear, I'm talking about the kind of support that is available in Subversion through svn:externals or something analogous.

Also, please cc me in any answers since I'm not sure my subscription to the list went through.

Thanks,

Luke Powell Project Engineer BJ Services

Shawn O. Pearce· Mar 13, 2007, 15:51 UTC · re: luke.powell@bjservices.com · lore

Re: git support for subprojects?

Luke.Powell@bjservices.com wrote:
Show 6 quoted lines
> Say that I have projects A and B which both depend on another project Z. 
> Whenever I update one of those projects, I'd like to also update to the 
> latest version of Z in a subdirectory. Is there that kind of support for 
> these subprojects? If I'm not being clear, I'm talking about the kind of 
> support that is available in Subversion through svn:externals or something 
> analogous.

In the Git community the concept of a subproject is more powerful than what you just described. But we haven't implemented those concepts yet in a released version (however there are prototypes floating around for discussion). ;-)

If all you want is an svn:externals type of hack, you can easily write a wrapper script to cd into the subproject Z and run `git pull`, merging in any recent changes from the upstream.

But we haven't automated that, as our concept of a subproject is much more sophisticated and doesn't always mean update the subproject to the latest version.

-- 
Shawn.
Jakub Narebski· Mar 14, 2007, 01:11 UTC · re: luke.powell@bjservices.com · lore

Re: git support for subprojects?

[Cc: git@vger.kernel.org]
Luke.Powell@bjservices.com wrote:
Show 6 quoted lines
> Say that I have projects A and B which both depend on another project Z. 
> Whenever I update one of those projects, I'd like to also update to the 
> latest version of Z in a subdirectory. Is there that kind of support for 
> these subprojects? If I'm not being clear, I'm talking about the kind of 
> support that is available in Subversion through svn:externals or something 
> analogous.
Git currently doesn't have submodule (subproject) support, although this
topic appears from time to time on git mailing list. There are even two
prototypes of proper submodule support; link to one of those (heavyweight
one by Martin Waitz) can be found at
  http://git.or.cz/gitwiki/SubprojectSupport
There is also lightweight submodule support proposal, but as author did
not put info in above page, and I don't have I think an URL saved...
It is I think what you might want.
But it should be fairly easy to cobble together something analogous
to broken[*1*] svn:externals with update hook...
 
> Also, please cc me in any answers since I'm not sure my subscription to 
> the list went through.
http://git.or.cz/gitwiki/GitCommunity  

[*1*] In short: you really, really want to bind/connect submodule commit (submodule version) to supermodule (main module) commit. E.g. you want to know for sure that v2.1.3 of your project pass all the tests and works with v0.2.1 of a submodule.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

← back to recent threads