Git: Submodules
Ready for some fun with Git submodules? Me too! Here’s a collection of the common operations involving submodules that I never seem to remember.
Checkout Repository As Submodule
You have a URL to a Git repository that you want to add as a submodule:
git submodule add https://url/to/the/repo.git
Remove Submodule
Apparently this was a recent addition to Git (2022). Why this was so hard to do in the past is beyond me, but I guess that’s Git, isn’t it.
git rm path/to/submodule
Source: Stack Overflow
Recursively Checking Out Submodules
Easiest way to checkout submodules once you’ve already cloned the repository:
git submodule update --init --recursive
Source: Stack Overflow