🧀 如何remove git submodule
git submodule 没有 remove 开箱即用的子命令
所以需要一系列的步骤,这里记录一下(以下是彻底删除)
- 如果需要备份的话,先备份
git submodule deinit -f path/to/xxx
这个命令的作用就是会去unregister submodule,path/to/xxx
下的内容会被情况,然后删除.git/confg
中关于path/to/xxx
的信息git rm -f path/to/xxx
如何没有加git,需要手动的执行git add
和git commit
来记录操作rm -rf .git/modules/path/to/xxx
手动的去删除这个目录下的子模块
或者使用magit
,emacs下可以通过 M-x magit-submodule-remove
来删除子模块,但是还需要执行上面的第3步.
This post is licensed under CC BY 4.0 by the author.