How to delete a Git submodule

Git submodules are a powerful way to use Git as an external dependency management toolThis is analogous to creating a soft link on your system.. This shot covers what needs to be done when you delete a project that has a submodule in it.

There are four steps involved when you delete a submodule.

1. deinit the submodule

git submodule deinit <submodule_directory>

2. Remove the submodule directory from Git

git rm <submodule_directory>

3. Remove the submodule directory from .git/modules/

rm -rf .git/modules/<submodule_directory>

4. commit and push the changes

git commit -m"Removed Submodule"
git push

Free Resources

Attributions:
  1. undefined by undefined