Nerf
Nerf

Reputation: 938

Git repos for large project

I have started working on new large project. It contains a lot of Web portals and microservices.

I was thinking how to structure git repo. At this moment I have this:

Main Folder(one repo)
     Portals(folder)
          Portal 1(folder)
          Portal 2(folder)
     Services(folder)
          Service 1(folder)
          Service 2(folder)

And the second option is:

    Main Folder(folder)
     Portals(repo)
          Portal 1(folder)
          Portal 2(folder)
     Services(repo)
          Service 1(folder)
          Service 2(folder)

And last option I was thinking:

 Main Folder(folder)
         Portals(folder)
              Portal 1(repo)
              Portal 2(repo)
         Services(folder)
              Service 1(repo)
              Service 2(repo)

What do you think? Is there any standard for doing this?

Upvotes: 0

Views: 165

Answers (2)

Dekker1
Dekker1

Reputation: 5786

There is no objective answer to this question. You should consider though that other than SVN and other earlier version control system Git does strive for small, modular and contained repositories. This makes it easier to branch, which is integral to Git's workflow.

When considering if two parts of a project should be in separate repositories, ask yourself the following questions:

  • Can the parts be used separately? (Yes? Then you should use seperate repositories.)
  • Will changes to one part almost always require changes to the other part? (No? Then you most likely should use seperate repositories.)
  • Will all parts follow the same release schedule? (No? Then you should use seperate repositories.)

Note that the last question in practice is an important one. Even is one part depends on the other part, but releases are not integrated, you should/could split these parts in different repositories. To solve the dependency you would then use Git submodules; this allows you to lock your dependency repository at a specific version.

Upvotes: 2

Andrejs Cainikovs
Andrejs Cainikovs

Reputation: 28434

For this particular scenario, I'd go with git submodules.

Main Folder(repo)
     Portals(folder)
          Portal 1(submodule)
          Portal 2(submodule)
     Services(folder)
          Service 1(submodule)
          Service 2(submodule)

This way all your sub-projects (Portals/Services) are isolated, yet centralized under one single repo. You easily can remove submodule, and continue working with your main repo, while removed module can still be alive and used for other projects, and can be added later if needed.

Read about git submodules here:

Upvotes: 1

Related Questions