How To: effectively delete a git submodule.

To remove a submodule you need to:

  1. git submodule deinit <path_to_submodule>
  2. git rm -f <path_to_submodule>
  3. git commit-m "Removed submodule "
  4. rm -rf .git/modules/<path_to_submodule>
  5. Delete the relevant section from .git/config.
  6. Stage the .gitmodules changes git add .gitmodules
  7. Run git rm –cached path_to_submodule (no trailing slash).
  8. Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  9. Commit git commit -m “Removed submodule “
  10. Delete the now untracked submodule files rm -rf path_to_submodule

(source)