I am working on an existing project where I need to implement Git version control. The challenge is deciding whether to use a monorepo or multirepo strategy. Here is the current folder structure, which must remain unchanged:
/pipeline
/project1
/project2
/project3
/etc.
/sharedcode1
/sharedcode2
/etc.
Details:
Each project typically has its own developer or, at most, a small team of up to three developers.
The projects are mostly independent of each other, with the exception of the /sharedcode directories, which are utilized across multiple projects.
Considerations:
I am leaning against using a monorepo because the projects and development teams are mostly independent.
My main concern with using a multirepo approach and Git submodules is the handling of submodules located outside the main project directory. For example, if I want /project1 to include /sharedcode1 and /sharedcode2 as submodules, these shared code directories are located outside of /project1.
When a developer clones /project1 into their local development environment, I want them to automatically get all the necessary submodules, resulting in a structure like this:
bash
/local_dev_environment
/project1
/sharedcode1
/sharedcode2
Questions:
- Is it feasible to manage submodules located outside the main project directory using Git?
- What are the best practices for handling shared code across multiple independent projects in this context?
- Are there alternative approaches or tools that I should consider to achieve efficient version control and code sharing?
Any suggestions or insights would be greatly appreciated. Thank you in advance!