Removing a submodule is useful when no longer required, follow the steps below:
- Delete the section referring to the submodule from the
.gitmodules
file - Stage the changes via:
git add .gitmodules
- Delete the relevant section of the submodule from
.git/config
- Run:
git rm --cached path/to/submodule
- Run:
rm -rf .git/modules/path/to/submodule
- Commit the changes:
git commit -m "Removed Submodule"
- Delete the now untracked dangling submodule files
rm -rf path/to/submodule