Let's say I have 3 git repositories, each with a lib
and tests
folder in the root. All 3 repositories are part of what I want to be a single package, however it is important to me to keep the repositories separate.
I am new to git coming from svn, so I have been reading up on submodules
and how they differ from svn:externals
. In SVN I could have a single
lib/vendor/package
directory, and inside package
I could setup 3 externals pointing to each of my 3 repositories lib
directory, renaming it appropriately like
lib/vendor/package/a -> repo1/lib
lib/vendor/package/b -> repo2/lib
lib/vendor/package/c -> repo3/lib
but from my understanding this is not possible with git. Am I missing something?
Really I'm hoping this can be solved in one of two ways.
- Someone will point out how to create a 4th git repository which has the other 3 as submodules organized as I have mentioned above (where I can have an
a
, b
, and c
folder inside the root)
- Someone will point out how to set this up using
svn:externals
in combination with githubs svn support, referencing the lib
directory within each git repository (from my understanding this is impossible)
Update:
I had actually tried to follow the submodules tutorial you linked to, but I run into the following problem.
Doing things as shown above, instead of a mapping like
lib/vendor/package/a -> repo1/lib
lib/vendor/package/b -> repo2/lib
lib/vendor/package/c -> repo3/lib
I am left with
lib/vendor/package/a -> repo1
lib/vendor/package/b -> repo2
lib/vendor/package/c -> repo3
this is not ideal since now to access ClassA
inside repo1
's lib
folder, the path is
lib/vendor/package/a/lib/ClassA
when I'm really trying to get (and this is possible with svn:externals)
lib/vendor/package/a/ClassA
since a
above is actually repo1/lib
, and not the root directory of repo1
.
Something like this is important since, with PHP5.3
for example, using the SplClassLoader
( http://gist.github.com/221634 ), it requires a namespace-to-directory mapping like
PackageaClassA -> lib/vendor/package/a/ClassA
this is where my conceptual misunderstanding is, how to setup that 4th git repository to allow my directory mappings like above.
See Question&Answers more detail:
os