I have a git repository that needs to be shared across multiple other projects as a shared library/common code. The projects using this common code are all TFS projects (TFS2013). I am able to host the git repo in TFS, but cannot figure out how to link the git and TFS repos together without duplication.
The idea I am trying to achieve is identical to git's submodules, where one git repo can be a submodule to N other git repos:
- CommonLib/ (git)
- src/
- inc/
- Project1/ (git)
- src/
- inc/
- lib/
-CommonLib (git submodule)
- Project2/ (git)
- src/
- inc/
- lib/
-CommonLib (git submodule)
But I would like to do this when the projects are TFS repositories:
- CommonLib/ (git)
- src/
- inc/
- Project1/ (TFS)
- src/
- inc/
- lib/
-CommonLib (?? How to link ??)
- Project2/ (TFS)
- src/
- inc/
- lib/
-CommonLib (?? How to link ??)
Is this possible?
One solution I came up with is just to clone the CommonLib repo into each of the project's lib/ directory and set the upstream remote appropriately. But then I have to check in the git repo into the TFS repo and that seems incorrectly to me.
I would like a developer who makes a source change in CommonLib within Project2, to be able to check in their changes to the git repo automatically when they checkin to TFS. Similar to how one would use a git submodule, where they can commit both the project changes (parent) and the submodule (child) changes in a single git commit from the parent.