Remove a git submodule
To remove a submodule you need to:
- Delete the relevant line from the .gitmodules file.
- Delete the relevant section from .git/config.
- Run git rm --cached pathtosubmodule (no trailing slash).
- Commit the superproject.
- Delete the now untracked submodule files.
Source(s): GitSubmoduleTutorial : https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial
Must find a simpler way...
Related protips:
Written by Santiago Gil
Related protips
6 Responses

I didn't found other way. It's the only.
You can write script to do it.
over 1 year ago
·
There is a topic-branch in git.git for git-submodule-rm, http://comments.gmane.org/gmane.comp.version-control.git/209755
over 1 year ago
·

@mindjiver Intresting. Thanks!
over 1 year ago
·

Why subprojects have to be so difficult...
over 1 year ago
·
Instead of manually editing .git/config
, I think that git submodule deinit
can be used more easily.
over 1 year ago
·

Thanks for the clear explanation of the steps
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Submodule
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#