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:

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?

  • In GIT, how can I prevent people from changing or removing commits that have already been pushed?
  • Git: Adding to index after already added? And other questions
  • Is it possible/reasonable to have multiple online repositories for a single project?
  • What is stage status in Git?
  • Accessing git repositories with redmine, permissions problem
  • Access to a file or folder on heroku server
  • 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.

    Git Baby is a git and github fan, let's start git clone.