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?

有帮助吗?

解决方案

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.
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top