git rm submodule

Haixin Pang February 25, 2025 #Git #FAQ

Original source: Stackoverflow

mv a/submodule a/submodule_tmp

git submodule deinit -f -- a/submodule
rm -rf .git/modules/a/submodule
git rm -f a/submodule
# Note: a/submodule (no trailing slash)

# or, if you want to leave it in your working tree and have done step 0
git rm --cached a/submodule
mv a/submodule_tmp a/submodule