Submodules in Git

From the Git cheat sheet · Advanced Techniques · verified Nov 2026

Submodules

Include other Git repositories within your project

bash
# Add submodule
git submodule add <url> <path>

# Clone with submodules
git clone --recurse-submodules <url>

# Update submodules
git submodule update --init
git submodule update --remote
💡 Submodules link to specific commits
⚠️ Remember to update submodules after pull
📌 Each submodule is a separate repository
⚡ git config submodule.recurse true makes pull and switch update them

Continue with Git

Save the full cheat sheet or work through every related task.

More Git tasks

Back to the full Git cheat sheet