我可以取消填充 Git 子模块吗?
一旦我运行,
git update submodule
我可以做些什么来让它回到初始化和更新之前的状态吗?
Once I run
git update submodule
can I do anything to make it go back to the way it was before init and update?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你说你想回到init和update之前,这就是子模块仍然存在于
.gitmodules
中的情况,但它是一个空目录,未在 .git/config 中注册。假设您的子模块名为
foo/bar
,那么您可以执行以下操作: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
.Suppose your submodule is called
foo/bar
, then you could do the following:尝试(使用 git1.8.3,2013 年 4 月 22 日)a:(
请参阅“如何删除 Git 子模块?”)
但您可能必须删除该子模块的工作树。
Try (with git1.8.3, April 22d 2013) a:
(See "How do I remove a Git submodule?")
You might have to delete the working tree for that submodule though.
如果您的更改已提交,那么您应该能够检查引用日志:
找到丢失的更改集后,您可以将其合并回来。
如果您的更改未提交 >,那么它们就无法恢复。
If you changes were commited, then you should be able to check the reflog:
Once you find the change set you lost you can merge it back in.
If your changes were not commited, then they cannot be recovered.