git stash 会重置子模块吗?
我是 git 新手。我想隐藏我的更改并在我的分支上执行 git pull origin master 。我正在开发的项目有子模块。
这些是我运行的命令:
git status
- 我可以看到我的所有更改(子模块+主项目)git stash push
没有错误或警告。我在项目的主目录中运行了它git status
- 所有更改都消失了(包括子模块)git pull origin master
- 有效(由于我们环境中的某些配置,也更新了子模块)git stash pop
- 没有错误或警告git status
- 子模块中完成的所有工作都消失了。
发生了什么 ?我知道 git stash 将为我隐藏的工作进行提交,然后执行 git git reset --hard
。为什么我的子模块工作消失了?如何正确地存储带有子模块的项目?
谢谢
I'm new to git. I wanted to stash my changes and do a git pull origin master
on my branch. The project that I'm working on has submodules.
Those are the commands I ran :
git status
- I can see all of my changes ( submodules + the main project )git stash push
no errors or warnings. I ran this in the main directory of my projectgit status
- All of the changes are gone ( submodules include )git pull origin master
- works ( updates the submodules as well due to some configuration in our environment )git stash pop
- no errors or warningsgit status
- all the work done in the submodules is gone.
What happened ? I know that git stash is going to make commits for my stashed work and after that do a git git reset --hard
. Why is my submodule work gone ? How do you correctly stash a project with submodules ?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,
git stash push
不会保存子模块内的更改(请参阅此问题和文档根本没有提及子模块),因此它不会恢复这些子模块变化。No,
git stash push
does not save the changes within submodules (see this question and the documentation that does not mention submodules at all) and it therefore does not revert those changes.