Submodules

Clone and initialize in one step

git clone --recurse-submodules https://github.com/user/repo.git /tmp/repo

The flag is easy to forget — without it, submodule dirs are empty (just a commit pointer) until initialized.

Already cloned without it

cd path/to/repo
git submodule update --init --recursive

Add a submodule to your own repo

Keeps it linked to upstream for updates:

git submodule add https://github.com/user/repo.git path/to/vendor/dir

Vendor instead of linking

To own the copy and sever the link to upstream, strip its .git dir(s) first — including any nested submodule .git dirs:

rm -rf path/to/vendor/dir/.git path/to/vendor/dir/nested-submodule/.git

Decision has a real consequence: anyone who later clones your repo inherits the same init-on-clone caveat if you go the submodule route instead of vendoring — worth documenting in a README troubleshooting section either way.