This page looks best with JavaScript enabled

How to Clone a Git Project With Submodule

 ·  ☕ 1 min read  ·  ✍️ shibu

Git clone and update submodule later

clone the repository

1
git clone <git repository>

You have to do two things to update submodule

1
2
git submodule init 
git submodule update

Git cloning including submodules

In git 2.13 version and later, –recurse-submodules can be used instead of –recursive:

1
git clone --recurse-submodules -j8 git://github.com/username/repository.git

heres, -j8 is an optional performance optimization that became available in version 2.8, and fetches up to 8 submodules at a time in parallel. for more details man git-clone

With version 1.9 of Git up until version 2.12 (-j flag only available in version 2.8+):

1
git clone --recursive -j8 git://github.com/username/repository.git

With version 1.6.5 of Git and later, you can use:

1
git clone --recursive git://github.com/username/repository.git
Share on

Shibu Deb Polo
WRITTEN BY
shibu
Web Developer