Reputation: 4758
I'm trying to come up with a reasonably clean way to represent the following in Git:
A base project that contains common code used across a number of projects.
Multiple projects that extend the base project with additional files in several subdirectories of the base project.
Extension projects often have project-specific modifications to the base project. We want the ability to push these modifications back upstream while not also pushing the extension specific stuff up.
My current thinking is something along the lines of:
Separate repos for base project and each extension project.
For each extension project, fork the base project and create a submodule for the extension-specific stuff. Symlink subdirectories of the submodule to the expected locations in the superproject directory structure.
Is there a better way?
Upvotes: 1
Views: 69
Reputation: 1323983
Is the code of the common project is really independent from the projects, then yes, submodules are a good choice.
But if changing the project also involve almost always changing the common code, and if the extension projects don't represent that many files... then one repo with a branch per extension project and a branch dedicated for common code could be enough.
That could then involve a bit of cherry-picking for the project-specific commits you want back in the common code branch.
Upvotes: 1