Git Subtree: Alternative to Git Submodule | Atlassian Git Tutorial

url
https://www.atlassian.com/git/tutorials/git-subtree

git subtree lets you nest one repository inside another as a sub-directory. It is one of several ways Git projects can manage project dependencies. A diagram showing the interaction between two repositories before and after using Git Subtree.

Why you may want to consider git subtree

Management of a simple workflow is easy. Older version of Git are supported (even older than v1.5.2). The sub-project’s code is available right after the clone of the super project is done. git subtree does not require users of your repository to learn anything new. They can ignore the fact that you are using git subtree to manage dependencies. git subtree does not add new metadata files like git submodule does (i.e., .gitmodule). Contents of the module can be modified without having a separate repository copy of the dependency somewhere else.

Drawbacks (but in our opinion they're largely acceptable):

You must learn about a new merge strategy (i.e.git subtree). Contributing code back upstream for the sub-projects is slightly more complicated. The responsibility of not mixing super and sub-project code in commits lies with you.