如何优雅地删掉 Git submodule (How effectively delete a git submodule)
参考地址:https://gist.github.com/myusuf3/7f645819ded92bda6677
步骤
- 从
.gitmodules文件中删除对应子模块的节(section)
- 通过
git add .gitmodules命令将.gitmodules文件添加到待提交区
- 从
.git/config文件中删除对应子模块的节(section)
- 运行
git rm --cached xxxx(子模块路径)命令
- 运行
rm -rf .git/modules/xxxx(子模块路径)命令
- 通过
git commit -m "删除子模块"命令提交删除操作
- 通过
rm -rf xxxx(子模块路径)将子模块彻底从项目中删除
原文
To remove a submodule you need to:
- Delete the relevant section from the .gitmodules file.
- Stage the .gitmodules changes git add .gitmodules
- Delete the relevant section from .git/config.
- Run git rm --cached path_to_submodule (no trailing slash).
- Run rm -rf .git/modules/path_to_submodule (no trailing slash).
- Commit git commit -m "Removed submodule "
- Delete the now untracked submodule files rm -rf path_to_submodule
如何优雅地删掉 Git submodule (How effectively delete a git submodule)
参考地址:https://gist.github.com/myusuf3/7f645819ded92bda6677
步骤
.gitmodules文件中删除对应子模块的节(section)git add .gitmodules命令将.gitmodules文件添加到待提交区.git/config文件中删除对应子模块的节(section)git rm --cached xxxx(子模块路径)命令rm -rf .git/modules/xxxx(子模块路径)命令git commit -m "删除子模块"命令提交删除操作rm -rf xxxx(子模块路径)将子模块彻底从项目中删除原文
To remove a submodule you need to: