Delete git submodule

git submodule deinit -f -- <name_of_submodule>
rm -rf .git/modules/<name_of_submodule>
# Note: The <name_of_submodule> shouldn't have the trailing slash
git rm -f <name_of_submodule>

git commit -m "Deleted submodule xyz"

Example

git submodule deinit -f -- a/submodule
rm -rf .git/modules/a/submodule
git rm -f a/submodule
git commit -m "Deleted submodule a/submodule"

References:

  • 1How do I remove a submodule?
Previous