Summarized from https://git-scm.com/book/en/v2/Git-Tools-Submodules
Add an existing Git repository as a submodule of the repository:
$ git submodule add <subproject-repo-url>
The default is to add the subproject into a directory named the same as the repository. Also creates a new .gitmodules
file, which is a configuration file that stores the mapping between the project’s URL and the local subdirectory you’ve pulled it into: