Submodules are a powerful, but sometimes perceived as complex piece of the Git toolchain. Submodules are, at the highest level, a facility for the composition of Git repositories (Figure 17-1).
But unlike some of their non-Git cousins such as SVN Externals, they default to offering greater precision, pointing not only at the network address of the nested repository, but also to the commit hash of the nested repository (Figure 17-2).
Because each commit ref has, within a repo, a unique identifier to a specific point in the graph and all parent states that led up to that point, pointing to the ref of another repo records that precise state in the commit history of the parent project.
Although Chapter 16 provides an exhaustive list of commands, a quick recap of the basic submodule actions is helpful:
Register a new submodule for this superproject and, optionally, express it in the specified folder name (can be a subfolder path relative to the root of the project).
Summary of the commit ref and dirtiness state of all submodules at this project level.
Use the .gitmodules long-term ...