Skip to content
Home Tutorials Roadmaps Courses
Log in Join free
Tutorials Git Git Submodules
Git Beginner FREE

Git Submodules

Lesson 1 of 17 Beginner Interactive

Submodules let you include other Git repositories as subdirectories.

Syntax

GIT
git submodule add URL path
git submodule init
git submodule update
git submodule foreach git pull
Git Submodules
BASH
# Add submodule
git submodule add https://github.com/user/lib.git libs/my-lib

# Clone with submodules
git clone --recurse-submodules https://github.com/user/repo.git

# Update submodules
git submodule update --remote

# Initialize submodules after clone
git submodule init
git submodule update