2

I have some huge projects and want to move from TFS to Git. For example, I have three projects: rep_test_sample, rep_test_edition, rep_test_core. Their reference relationship is following. The last two projects "rep_test_core" and "rep_test_edition" are infrastructure projects, they will be referenced by some other projects (actually, the infrastructure projects count is about 70). enter image description here

I tried to create three repositories for each project. And the local structure is following: /dev /dev/rep_test_core/ /dev/rep_test_edition/ /dev/rep_test_sample/ (I have several other sample projects as well)

I can clone three repositories one by one, after code changes on three projects, I need to check the status and commit one repository after another. But I found it is easy to miss something with too many repositories.

I also considered to create only one repository. The downside for me is that, I have several sample projects, the first clone needs download many unnecessary files for me.

What is the best repository structure so that I could manage my projects easily with Git? Or Git is fit for this kind of project scenario?

More accurate, here is a diagram that simulate my current structure on TFS. enter image description here

Howard
  • 3,638
  • 4
  • 32
  • 39

1 Answers1

4

Those projects will be regrouped into several products

You can create one Git repo per product, and in each product git repo, add those projects as submodules.

That way, you can clone only one repo, and start modifying each submodule repo in that one clone.

The only overhead is, for each submodule modification, to:

  • add, commit and push inside that submodule
  • go back to the parent product repo, add, commit and push (in order to record the new gitlink, special entry in the index)
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I guess you mean `submodules` instead of `submmodules`. :-) – skypjack Nov 09 '15 at 07:57
  • @skypjack I have fixed that typo. – VonC Nov 09 '15 at 07:58
  • I considered this way, but I think there is another overhead. For example like the complex project structure I attached above. When I opened "web_sample1", then add "product_web" and "product_core" as submodules. Those two repositories will be two subfolders inside of "web_sample1" folder. Then I switch to "web_sample2" and do the same reference. In this case, the "product_web" and "product_core" will have two copies in two sample folders. Is that right? or did I miss something? – Howard Nov 09 '15 at 08:02
  • @Howard no, that is the reverse: you open product_web, which as web_sample_xx submodules in it. – VonC Nov 09 '15 at 08:08
  • That is an option. But it doesn't make sence if we have many sample projects. When we use TFS, if we want to open solution "web_sample1", we only load three projects: "web_sample1", "product_web", "product_core". If use the reverse version, "web_sample1" becomes a submodule of "product_web", and "product_web" becomes a submodule of "product_core". If we want to debug "web_sample2", we need to add "web_sample2" as submodule of "product_web". Then the core folder will become large in the future if we have many sample projects to maintain. This is the issue we wanna figure out. – Howard Nov 09 '15 at 08:47
  • @Howard Then you can use your first approach and define submodule as a parent repo "web_project1_parent", with "web_project1", "product_web" and "product_core" in it. It is true that when opening "web_sample2_parent", "product_web" and "product_core" will have two copies in two sample folders. – VonC Nov 09 '15 at 08:49