Submodules allow you to keep a Git repository as a subdirectory of another Git repository.
A submodule allows you to keep a Git repository as a subdirectory of another Git repository. This lets you clone another repository into your project and keep your commits separate. [Pro Git book]
The parent repo keep track of a submodule in:
- a
.gitmodules
file (for the url of the sub repo) - a special entry in its index, called gitlink for the commit hash at which the submodule is checked out (a submodule is always initialized in a detached HEAD mode)