Retrieve submodules with Git

Reading time  is 1 minute

Yesterday I had a really hard time with pulling in a submodule from an old git repository I had laying around. I thought a quick Google with DuckDuckGo would solve all my problems, but alas. There was a lot of outdated information that simply didn’t work with the Git version I had installed on my computer (or maybe I just applied it incorrectly).

Finally I found an answer on StackOverflow that didn't quite work, but send me in the right direction. Eventually I gave up the DuckDuckGoing and did what I should have done in the first place: Look at the Git documentation for the submodule command.

The command I ran (from the root of my git folder) that worked for me after I cloned my repository was:

git submodule update --init --recursive

An important lesson learned: If there is documentation available, consult that first.