Git: How to remove submodule

·1 min read·paskov

Quick tip on how to remove Git submodule.

  1. Remove the relevant line from the .gitmodules file

  2. Delete the relevant section from .git/config (if any)

  3. Run

    git rm --cached path_to_submodule

    (without trailing slash)

  4. Commit and delete the now untracked submodule files.