Submodules or subtrees could indeed be a solution.
On the other hand you could keep the repos totally independent from a git point of view, and publish your libraries.
Eg: Assuming you're working with Maven in Java, when you want to upgrade example_library1
in example_project1
you could:
- Build a new version of the library (and tag the corresponding commit)
- Put this binary either in a local or shared maven repository
- Update the version of the library in the
pom.xml
of your project
An advantage of this approach would be that there are no need to do anything complicated with Git
Drawbacks would be:
- It may be cumbersome if you want to upgrade in your application every time you commit in your library
- If you don't already have a "package architecture", you may need to set it up first