The Git submodules solution – a repository inside a repository
The subtrees method of importing the code (and possibly also the history) of a subproject into the superproject has its disadvantages. In many cases, the subproject and the container are two different projects: your application depends on the library, but it is obvious that they are separate entities. Joining the histories of the two doesn’t look like the best solution.
Additionally, the embedded code and imported history of a subproject are always here. Therefore, the subtrees technique is not a good fit for optional dependencies and components (such as plugins or themes). It also doesn’t allow you to have different access controls for the subproject’s history, with the possible exception of restricting write access to the subproject (actually to the subdirectory of a subproject), by using Git repository management solutions such as gitolite
(you can find more in Chapter 14, Git Administration...