Git Submodule Basic Usage Examples

Last updated:

creating a submodule

(submodule gets created, but files aren't actually put into the folder)

inside an existing git repository, do:

git submodule add git:// some_folder

initialising (populating) the submodule

(this is where files get actually downloaded)

in the outer repository, do:

git submodule init

and then do:

if the submodule refers to a remote repo, do git submodule update --remote instead

git submodule update

Dialogue & Discussion