Subtree merging
An alternative to submodules is subtree merging. Subtree merging is a strategy that can be used when performing merges with Git. The strategy is useful when merging a branch (or, as we'll see in this recipe, another project) into a subdirectory of a Git repository instead of the root directory. When using the subtree merge strategy, the history of the subproject is joined with the history of the super project, while the subproject's history can be kept clean, except for commits intended to go upstream.
Getting ready
We'll use the same repositories as in the last recipe, and we'll reclone the super project to get rid of the submodule setup:
$ git clone https://github.com/PacktPublishing/Git-Version-Control-Cookbook-Second-Edition_Super.git
$ cd Git-Version-Control-Cookbook-Second-Edition_Super
How to do it...
- We'll add the subproject as a new remote and fetch the history:
$ git remote add lib_a https://github.com/PacktPublishing/Git-Version-Control-Cookbook-Second-Edition_lib_a...