Git 存储两次
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18063521/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git stash twice
提问by stephenmurdoch
I had to quickly switch git branches, so I ran git stash
, but I had to run it again because one of my files needed editing.
我不得不快速切换 git 分支,所以我运行了git stash
,但我不得不再次运行它,因为我的一个文件需要编辑。
So I've run git stash
twice, and I'm ready to go back to editing my files. I ran git stash apply
but I'm not convinced that all of the files I had stashed were unstashed. Is there anything I can do? Any way to check?
所以我已经运行了git stash
两次,我准备回去编辑我的文件。我跑了,git stash apply
但我不相信我藏起来的所有文件都没有藏起来。有什么我可以做的吗?有什么办法查吗?
When I run git stash show
, I just see the last of my two git stashes.
当我运行时git stash show
,我只看到我的两个 git stash 中的最后一个。
Is there anyway to show all git stashes
?
反正有没有显示所有git stashes
?
回答by Felix Kling
You can get a list of all stashes with
您可以获得所有藏匿处的列表
git stash list
which will show you something like
这将向您展示类似的东西
stash@{0}: WIP on dev: 1f6f8bb Commit message A
stash@{1}: WIP on master: 50cf63b Commit message B
If you made two stashes, then just call git stash pop
twice. As opposed to git stash apply
, pop
applies and removesthe latest stash.
如果您进行了两次隐藏,则只需调用git stash pop
两次即可。与 相反git stash apply
,pop
应用并删除最新的存储。
You can also reference a specific stash, e.g.
您还可以引用特定的藏匿处,例如
git stash show stash@{1}
or
或者
git stash apply stash@{1}
回答by Waaheeda
I came across this situation, I did two stashes and git stash popjust unstashed last stash. So I did
我遇到了这种情况,我做了两次stash,而 git stash pop只是取消了最后一次 stash。所以我做了
git stash list
git stash pop stash@{1}
This unstashed my first stash and I could see all my changes back!
这解除了我的第一个隐藏,我可以看到我所有的更改!