我可以取消填充Git子模块吗? [英] Can I unpopulate a Git submodule?

查看:105
本文介绍了我可以取消填充Git子模块吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦我运行

Once I run

git update submodule

我可以做任何事情来让它恢复到init和update之前的状态吗?

can I do anything to make it go back to the way it was before init and update?

推荐答案

你说你想回到 init 更新之前,这就是子模块仍然存在于 .gitmodules ,但它是一个空的目录,它没有在 .git / config 中注册。

You say that you want to go back to before init and update, which would be the situation where the submodule is still present in .gitmodules, but is an empty directory which isn't registered in .git/config.

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

Suppose your submodule is called foo/bar, then you could do the following:

# 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

这篇关于我可以取消填充Git子模块吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆