Back to git main page
If you want to fully remove a submodule, the following things have to done :
Assume that the submodule is called submod and that it's path relative to the root of the git repo is external/gits
Open a terminal in the root of the git repo, and edit the .gitmodules file to remove the entry
[submodule "external/gits/submod"] path = external/gits/submod url = https://github.com/user/submod.git
Remove git tracking of the submodule folder, but keep the files :
git rm --cached -r external/gits/submod
Remove the submodule from git config (all variables are remove using section) :
git config --remove-section submodule.external/gits/submod
stage and commit the changes in .gitmodules
git add .gitmodules git commit -m "Remove submodule submod"
Remove the submodules from .git/modules
rm -rf .git/modules/external/gits/submod
Finally, push the changes to the remote repo
git push
Note that the files are still on the host, to remove them just use rm :
rm -rf external/gits/submod