from stackoverflow
# git rm the_submodule
# rm -rf .git/modules/the_submoduleIf the second line isn't used, even if you removed the submodule for now, the remnant .git/modules/the_submodule folder will prevent the same submodule from being added back or replaced in the future. Also, git rm will do most of the job on a submodule.
The two commands (although functionally sufficient to remove a submodule), do leave a trace in the [submodule "the_submodule"] section of .git/config (as of July 2017), which can be removed using a third command:
# git config -f .git/config --remove-section submodule.the_submodule 2> /dev/null