How to clone a repository including the submodules or sub repositories in Git?

January 8, 2021 - 1 min read

Sometimes we may want to clone a repository which in turn contains sub repositories or sub-modules. We can clone these sub-modules by passing --recurse-submodules flag to the git clone command.

It can be done like this,

git clone --recurse-submodules <GIT_REPO_URL>

This will fetch all the submodules included in the main repository. 🌟

Feel free to share if you found this useful 😃.