Gotchas for Submodules

4.7. Gotchas for Submodules#

  1. Submodules Do Not Update Automatically ⚠️: Submodules are not automatically updated to the latest commit.

  2. Repository Resides in the .git Folder of the Parent Repo 🔒: The metadata for submodules is stored in the parent repository’s .git folder.

  3. Submodule Commits Are Detached 🤔: submodules are designed to be pinned to a specific commit and do not track a branch.

  4. Submodule URLs Can Change 🔗: You might need to update the .gitmodules file manually.

  5. Cloning with Submodules Requires Extra Steps 🛠️: Remember to use the --recurse-submodule option when cloning.

  6. Submodules Can Increase Complexity 🌀: This might be confusing for newcomers.