删除隐性的git submodule

删除隐性的git submodule

(金庆的专栏 2018.8)

正常的submodule会在 .gitmodule 文件中,TortoiseGit 会有 Submodule Update 菜单。
还有一种隐性的 submodule, .gitmodule 文件中看不到它,无法 update.
golang开发中的vendor目录下经常会不小心添加一个带 .git 的目录,就变成了一个假的submodule.
用 Repo-browser 看这个目录是个submodule链接, clone 出来就只有一个空目录。

删除这个submodule不能用 git delete, 提交时会报错:

git.exe add -f [...]

fatal: pathspec 'src/vendor/github.com/grpc-ecosystem/grpc-opentracing' did not match any files

git did not exit cleanly (exit code 128)

git delete 父目录也无法提交。

但是可以直接删除(不用git delete), 然后提交并Push. 好像只有这个办法。

猜你喜欢

转载自blog.csdn.net/jq0123/article/details/82218014