2

i'm quiet new to git and i don't know how to solve this specific problem in the best way. Hope you guys can offer me some good solutions. I searched the web but couldn't find an example like this which solved my issue. Maybe it's an design flaw? I just can't find a good solution.

I have the following projects:

  • Common
  • SqlApi: depends on specific Common version
  • CoreLogic: depends on specific Common and SqlApi version
  • Project A: depends on specific CoreLogic, SqlApi and Common version
  • Project B: depends on specific CoreLogic and Common version

With submodules, the working directory of Project A looks like this:

Project A
    - Common(1)
    - SqlApi(1)
        + Common(2)
    - CoreLogic
        + Common(3)
        + SqlApi(2)
            * Common(4)

Is there an better way to get rid of the Common (2-4) and SqlApi (2) and let them all link to the same Common/SqlApi(1) version within one Project?

Maybe im just "routine-blinded" but i need some help to figure this out.

s7urmi
  • 23
  • 1
  • 2

1 Answers1

0

Is there an better way to get rid of the Common (2-4) and SqlApi (2)

Simple: in ProjectA, you only make a git submodule update --init, instead of git submodule update --init --recursive (or git clone --recursive).

That will give:

Project A
    - Common(1)
    - SqlApi(1)
    - CoreLogic

That means:

  • SqlAPI and CoreLogic are able build based on variables (one variable for Common path, one variable for SqlAPI path,
  • Project A has a build script which will set SqlAPI and Common path adequately.

That doesn't easily show that the versions might different/overlapping between the ones needs by Project A and the ones needed by one of the submodules.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for the reply. That means that git will checkout/update the commits which are referenced via the submodules of Project A for SqlApi and Common, am i right? – s7urmi Nov 24 '15 at 10:05
  • @s7urmi yes, Project1 records as [**gitlink**](http://stackoverflow.com/a/16581096/6309) ([special entries in the index](http://stackoverflow.com/a/19354410/6309)) the SHA1 of those submodules. – VonC Nov 24 '15 at 10:06
  • k, that sounds good, i'll try immediately. Thanks for your help! – s7urmi Nov 24 '15 at 10:10