撤消 git stash
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10827160/
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
Undo a git stash
提问by adit
I just did a stash in a project that I haven't commit. Is there a way to go back to the state before I stashed? How could I do this? I've closed the terminal and my laptop is shut down. I've done some researched and it seems there's no way to do this.
我刚刚在一个我没有提交的项目中做了一个隐藏。有没有办法回到我藏之前的状态?我怎么能这样做?我关闭了终端,我的笔记本电脑也关机了。我已经做了一些研究,似乎没有办法做到这一点。
回答by ziad-saab
You can just run:
你可以运行:
git stash pop
and it will unstash your changes.
它会解开您的更改。
If you want to preserve the state of files (staged vs. working), use
如果要保留文件的状态(暂存与工作),请使用
git stash apply --index
回答by OmnipotentEntity
git stash list
to list your stashed changes.
git stash list
列出您隐藏的更改。
git stash show
to see what n
is in the below commands.
git stash show
查看n
以下命令中的内容。
git stash apply
to apply the most recent stash.
git stash apply
应用最新的存储。
git stash apply stash@{n}
to apply an older stash.
git stash apply stash@{n}
应用较旧的存储。
回答by wisbucky
This will also restore the staging directory:
这也将恢复临时目录:
git stash apply --index