Submodules aren’t removed using git rm submodule-dir, they need to be removed in a far more thorough and annoying fashion.
There are a number of unclear explanations at various sources so I decided to write my own findings.
Delete the relevant parts from the
.gitmodulesfile.EG:
1 2 3[submodule "blog/themes/PaperMod"] path = blog/themes/PaperMod url = https://github.com/adityatelange/hugo-PaperMod.gitStage .gitmodules via
git add .gitmodulesRemove the relevant parts from
.git/configEG:
1 2[submodule "blog/themes/PaperMod"] url = https://github.com/adityatelange/hugo-PaperMod.gitClear the cache with
git rm --cached /path/to/submodule- with no trailing slash. Including the trailing slash will throw an errorRemove the .git modules submodule data by running
rm -rf .git/modules/submodule_nameorrm -rf .git/modules/submodulefoldernameCommit the changes
Delete the submodule files
rm -rf path/to/submodule
