0

I have been thinking awhile how to achieve the below goals for quite awhile. Think I'm not expert in Git to have enough knowledge to craft a good infrastructure. Anyone of you can give me the suggestions?

Scenario:

Product A, B, C Client X, Y, Z

Client X has Product A only.
Client Y has Product A and B.
Client Z has Product B and C.

Initially I was thinking the base should be Repo A, B and C separately and each of them will have separate module in different folder in case Client has specific request on the product. But later something comes into my mind, what if I fetch and pull from Repo A? Will the separate module being pulled together at once? How should I do it or any other better infrastructure?

Eric T
  • 1,026
  • 3
  • 20
  • 42

1 Answers1

1

what if I fetch and pull from Repo A? Will the separate module being pulled together at once?

No: each repo is independent.

I would recommend three additional repos, for referencing the right submodules.

  • RepoX for Client X: references one submodule A
  • RepoY for Client Y: references two submodules A and B
  • RepoX for Client Z: references two submodules B and C

The idea (with submodules) to record the exact SHA1 of each product you need for a given client.
that way, if you pull one Product repo:

  • it doesn't have any influence on the other Product repos
  • you go back one level up in the parent repo (a Client repo), add and commit the new state of your submodule, recording the change you made in said submodule.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi I roughly got the idea which said to have extra repo to deploy submodules. But by referring to this site http://git-scm.com/book/en/Git-Tools-Submodules My eyes started to get dizzy.. Is this the only option? – Eric T Nov 26 '13 at 08:20
  • 1
    @EricT yes, but submodules are really trivial: `git submodule add /url/to/RepoA repoA`. `git submodule update --init`. Done. I documented more on submodules at http://stackoverflow.com/a/1979194/6309 – VonC Nov 26 '13 at 08:22
  • 1 more question, as I read submodules is created in a subdirectory. If the project is in framework style wouldn't this be an issue like you need a folder in controller, another in view and one more in model? How to overcome this situation? – Eric T Nov 27 '13 at 04:19
  • 1
    @EricT if one assumes one parent repo including the controller, view and model, it would also include a folder for the submodule, and then you can symlink said folder in each controller, view and model directories. – VonC Nov 27 '13 at 06:21
  • ohh after proof of concept, I manage to gone through the tutorial but not confidence against the symlink as in http://git-scm.com/book/en/Git-Tools-Submodules says "This is an important point with submodules: you record them as the exact commit they’re at. You can’t record a submodule at master or some other symbolic reference.". Not sure if I mistakenly understand that phrase :/ – Eric T Nov 27 '13 at 07:49
  • 1
    @EricT yes, but that tutorial is old: see http://stackoverflow.com/a/9189815/6309: you can make a submodule *follow* a branch. – VonC Nov 27 '13 at 07:51
  • Hi @VonC, is it possible to get your messenger to discuss further about the concept? Don't know if it is right to ask for personal details this way. – Eric T Nov 28 '13 at 03:12
  • @EricT sure: vonc at laposte dot net – VonC Nov 28 '13 at 06:11
  • Hi @VonC, sadly to tell that I couldn't read french. Not sure if you have the common one like fb, win live msnger, or some others? – Eric T Nov 28 '13 at 07:17
  • @EricT it is an email address, but know that any generic question about Git will be bumped back to Stack Overflow (where I and other will answer them). – VonC Nov 28 '13 at 07:39