Delete a submodule

Git, Repository, Submodule · Apr 13, 2021

Deletes a submodule from the repository.

  • Use git submodule deinit -f -- <submodule> to unregister the specified <submodule>.
  • Use rm -rf .git/modules/<submodule> to remove the directory of the submodule.
  • Use git rm -f <submodule> to remove the working tree of the submodule.
git submodule deinit -f -- <submodule>
rm -rf .git/modules/<submodule>
git rm -f <submodule>
git submodule deinit -f -- 30code
rm -rf .git/modules/30code
git rm -f 30code
# Removes the `30code` submodule

Written by Angelos Chalaris

I'm Angelos Chalaris, a JavaScript software engineer, based in Athens, Greece. The best snippets from my coding adventures are published here to help others learn to code.

If you want to keep in touch, follow me on GitHub.

More like this