0Pricing
Git Advanced: Monorepo, Submodules & Workflows · Lesson

Removing and Deinitializing Submodules

Learn the correct, complete procedure for removing a Git submodule from a repository, including deinitialization, cleanup of .gitmodules, and avoiding leftover state.

When You Need to Remove a Submodule

Submodules are added to pull in external code, but requirements change. You may need to remove one when the dependency is replaced, vendored directly, or simply no longer needed.

Removal is more involved than deleting a folder: a submodule lives in several places at once, and missing one leaves your repo in a broken state.

Where a Submodule Lives

A submodule has three footprints:

  • .gitmodules — the declarative config
  • .git/config — your local active config
  • .git/modules/<path> — the cached submodule git data

Plus the working tree folder itself. Clean removal touches all of these.

All lessons in this course

  1. Introduction to Git Submodules
  2. Adding and Cloning Submodules
  3. Updating and Synchronizing Submodules
  4. Removing and Deinitializing Submodules
← Back to Git Advanced: Monorepo, Submodules & Workflows