git submodule add [-b <branch>]<repository> [<path>]git submodule initgit submodule update
git config -f .git/config --remove-section submodule.$submodulepathgit config -f .gitmodules --remove-section submodule.$submodulepath
git rm --cached $submodulepath
rm -rf $submodulepathrm -rf .git/modules/$submodulepath
When you do git submodule add, it only adds it to .gitmodules, but once you did git submodule init, it added to .git/config.
So if you wish to remove the modules, but be able to restore it quickly, then do just this:
git rm --cached $submodulepathgit config -f .git/config --remove-section submodule.$submodulepath
It is a good idea to do git rebase HEAD first and git commit at the end, if you put this in a script.