中止`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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 12:57:58  来源:igfitidea点击:

Aborting `git stash apply`

gitgit-stash

提问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 stashagain, possibly with a git reset HEADfirst.

如果你还没有承诺,你应该能够git stash再次承诺,可能是git reset HEAD第一次。

Also, git stash applydoesn't delete the stash like git stash popdoes. 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](如果您已推送)并在您位于正确的分支上后再次应用存储。