中止`git stash apply`
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9242844/
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
Aborting `git stash apply`
提问by abernier
Possible Duplicate:
How to reverse apply a stash?
可能的重复:
如何反向应用存储?
I regret having applied a stash (wrong branch). How can I undo this and have my stash back to my stash list in order to apply it later on the right branch?
我很遗憾应用了 stash(错误的分支)。如何撤消此操作并将我的藏匿处放回我的藏匿处列表,以便稍后将其应用到正确的分支上?
回答by Brandan
If you haven't committed, you should just be able to git stash
again, possibly with a git reset HEAD
first.
如果你还没有承诺,你应该能够git stash
再次承诺,可能是git reset HEAD
第一次。
Also, git stash apply
doesn't delete the stash like git stash pop
does. So if you have committed, you could git reset --hard [last_good_commit]
(if you haven't pushed) or git revert [last_good_commit]
(if you have pushed) and just apply the stash again once you're on the right branch.
此外,git stash apply
不会像git stash pop
那样删除存储。因此,如果您已提交,则可以git reset --hard [last_good_commit]
(如果您尚未推送)或git revert [last_good_commit]
(如果您已推送)并在您位于正确的分支上后再次应用存储。