Submodules

Nest repositories inside repositories

Submodules let you include one Git repository inside another. The parent repo tracks a specific commit of the child.

A submodule is a Git repo embedded inside another repo. The parent tracks a specific commit of the child.

Repository Structure
myapp/
.gitmodules
src/
app.js
libs/
utils/@ abc1234
directory
file
submodule
Terminal
# Add a submodule
$ git submodule add https://github.com/lib/utils.git libs/utils

# This creates:
# .gitmodules  - tracks submodule URLs
# libs/utils/  - the nested repository

# The parent repo stores a pointer to
# a specific commit in the submodule