Remove the files associated to the submodule
rm -rf .git/modules/path/to/sub-module-1
Remove any references to submodule in config and .gitmodules manually.
vim .git/config
vim .gitmodules
delete folder sub-module-1 folder and stage this change first
rm -rf path/to/sub-module-1
git add path/to/sub-module-1
then, you will add sub-module-1 again successfully.
git submodule add url path/to/sub-module-1
本文介绍了如何删除子模块文件、配置项,手动移除引用,然后重新添加子模块到Git项目中,确保流程包括rm命令、git config和.gitmodules编辑,以及git submodule add的使用。

被折叠的 条评论
为什么被折叠?



