我可以在Git子模块中取消填充吗?

use*_*638 8 git git-submodules

一旦我跑了

git update submodule
Run Code Online (Sandbox Code Playgroud)

我可以做任何事情让它恢复到初始化和更新之前的状态吗?

Mar*_*air 7

你说你想在initupdate之前返回,这可能是子模块仍然存在的情况.gitmodules,但是是一个未注册的空目录.git/config.

假设您的子模块被调用foo/bar,那么您可以执行以下操作:

# Move the submodule out of your repository, just in case you have changes
# in there that you realise afterwards that you'd like to preserve:
mv foo/bar/ ~/backups/old-foo-bar/

# Recreate the submodule directory, but empty this time:
mkdir foo/bar/

# Remove all the config variables associated with that submodule:
git config --remove-section submodule.foo/bar
# Note that the submodule name is *without* the trailing slash
Run Code Online (Sandbox Code Playgroud)