To fully remove a submodule from a git repository:

# Remove from .gitmodules
git submodule deinit <submodule_name>

# Remove from repository
rm -rf .git/modules/<submodule_name>

For older versions of Git, you may need to do the following as well:

# Remove from config
git config --remove-section <submodule_name>

# Remove from working tree
git rm --cached <submodule_path>