Structure of git repos where code shared across repos needs to be in the root of the repo
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.
- Git cancel a revert
- Move prototype code out of master branch with git
- How can I have files in Git that don't sync with remote, or get bypassed when deployed?
- upgrade a revised module using GIT
- Best Practices for using Git with Intellij Idea
- How to pack all loose objects in Git?
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?
One Solution collect form web for “Structure of git repos where code shared across repos needs to be in the root of the repo”
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.