This question already has an answer here:

I am working on a project which is split into multiple git repositories instead of just one. Each repository is for a library or an application. The libraries are used by the projects or other libraries.

So I often have to deal with multiple repositories, for pulling the latest change, for working on a feature which spans more than one repositories and me to keep track of what repositories are affected, ....

I have wondered why the project is split into multiple repositories instead of just one, but I haven't found the right person to ask.

So what are cons and pros between the two version control designs of a project: multiple repositories, vs single repository or just a few repositories?


marked as duplicate by gnat, 8bittree, enderland, David Hammen, Kilian Foth Jun 20 '17 at 8:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Have you tried using git submodules to manage the connections between the projects? – FrustratedWithFormsDesigner Apr 19 '17 at 21:13
  • Thanks. Nice to know, I didn't know it. Still wondering about my question. – Tim Apr 19 '17 at 21:18
  • 2
    questions asking for pros and cons usually get closed here, FYI. Probably because it can be very hard to give a single definitive answer. Pros and Cons could vary by context. And some peoples' Pros are other peoples' Cons. More here: softwareengineering.meta.stackexchange.com/questions/6758/… – FrustratedWithFormsDesigner Apr 19 '17 at 21:20

Having several subprojects there are a some scenarios varying in usage extend.

Typically: working on the sources of some projects, and just using others as code with source inspection (or just decompiled code).

This can mean faster compilation, or more source control.

To work with such subprojects or modules a build infrastructure like maven allows for defining dependencies.

  • The advantage of many repositories is a larger decoupling (like in no longer using a library in a larger project), better engineering (preventing cyclic dependencies between modules).

  • The advantage of a large repository: you can still check-out single modules, and you specify a structure, hierarchy.

  • The disadvantage of many repositories is that over time the structure may change. Maintenance of a snapshot/tagged version at a point in time will become hairy.

  • The disadvantage of a large repository: the structure can become messy. You will keep obsolete libraries.

Conclusion: "It depends"

I like a modular and layered structure: independant libraries (like for vector graphics), dependant libraries (DAO objects) belonging to some applications, large applications.

Use something like maven, do not be afraid to throw away version history and refactor at large. Go for a big structure, but keep reusable small libraries (like for PDF) independant.

I doubt this will help much, one has to experience organizing large projects, splitting them up, doing some refactoring.

Not the answer you're looking for? Browse other questions tagged or ask your own question.