Referring to the same submodule twice
I have two code libraries A and B and have started developing an application M.
All three of these are stored in their own repository.
My problem is that I have a dependency such that A uses submodule B, but M uses both submodules A and B.
As far as I can tell I’ll have two copies of the same submodule B for the same main project. But it would never make sense (in this setup) for them to be different, as they represent the same library in the same application.
Is there a way to work around this, so that when I work on M I have only one copy of A and B?
2 Solutions collect form web for “Referring to the same submodule twice”
M--/ |-- A | |-- B | |-- B
M/B submodule from
M, and keep/use
Asubmodule(a independent repository), it must needs
Mrepository, you can teach it to use
As i understand in your app M hierarсhy is something like this:
M / |- A / |- B
So to add submodule B to A you should do (in folder A)
git submodule add firstname.lastname@example.org:username/B.git
For the app M you should do the same but with path to existing B (in folder M)
git submodule add email@example.com:username/B.git A/B