Remove Git Submodules

This is just a repost of https://gist.github.com/kyleturner/1563153.

To remove a submodule you need to:

  • Delete the relevant line from the .gitmodules file.
  • Delete the relevant section from .git/config.
  • Run git rm –cached path_to_submodule (no trailing slash).
  • Commit and delete the now untracked submodule files.