You can remove a submodule (e.g. the_submodule
) by calling:
$ git submodule deinit the_submodule
$ git rm the_submodule
git submodule deinit the_submodule
deletes the_submodule
s' entry from .git/config. This excludes the_submodule from git submodule update
, git submodule sync
and git submodule foreach
calls and deletes its local content (source). Also, this will not be shown as change in your parent repository. git submodule init
and git submodule update
will restore the submodule, again without commitable changes in your parent repository.
git rm the_submodule
will remove the submodule from the work tree. The files will be gone as well as the submodules' entry in the .gitmodules
file (source). If only git rm the_submodule
(without prior git submodule deinit the_submodule
is run, however, the submodules' entry in your .git/config file will remain.
Taken from here:
.gitmodules
file..gitmodules
changes git add .gitmodules
.git/config
.git rm --cached path_to_submodule
(no trailing slash).rm -rf .git/modules/path_to_submodule
git commit -m "Removed submodule <name>"
rm -rf path_to_submodule