Let's simplify the question considering the following scenario.
I'm working with three C++ projects stored in three different Git repositories. All projects need to live in a separate repo because they need to be independent during the development.
- Project 1
- Project 2
- Common Code Project
To compile Project 1 you need Common Code version 1 (e.g. an older version). To compile Project 2 you need Common Code version 2 (e.g. a newer version).
Sometimes you want to work with the Common Code Project as a standalone project (kind of a standalone shared library), compile it, do tests, and possibly advance with new versions, branches etc.
Project 1 and 2 will keep their stories and they are likely to require different old versions of the Common Code for the compilation even if the Common Code advances in its personal story.
I need to work on all the projects on the same machine switching multiple time between them in the same day, so the working model can't be too complicated to avoid errors or problems.
Should I work with 3 parallel repositories resolving the compilation dependencies on the version at compile time (e.g. by checking out the correct version of the repo before compiling)? Is there any other better solution (e.g. Git Submodules)?