Git submodules in 30 seconds

Sometimes during your devops journeys you will encounter source code where the author decided to use git submodules.

Although there is exhaustive documentation on how to use submodules, here is a 30 second overview to get you started.

quick git submodules, like this supersonic plane! source https://www.pxfuel.com/en/free-photo-jzmlg

Clone

git clone

Find

Does your repository have submodules?

find . -mindepth 2 -name .git

Initialize

In each directory, initialize the submodule. You must be inside the directory.

git submodule init

Synchronize

In each directory, synchronize the submodule. You must be inside the directory.

git submodule sync