正在中止 `git stash apply`

发布于 2025-01-04 19:47:00 字数 63 浏览 2 评论 0原文

我很遗憾应用了存储(错误的分支)。我如何撤消此操作并将我的存储返回到我的存储列表,以便稍后将其应用到正确的分支?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别低头,皇冠会掉 2025-01-11 19:47:00

如果您还没有提交,您应该能够再次git stash,可能首先使用git reset HEAD

此外,git stash apply 不会像 git stash pop 那样删除存储。因此,如果您已提交,则可以 git reset --hard [last_good_commit] (如果您尚未推送)或 git revert [last_good_commit] (如果您已推送)当你到达正确的分支时,只需再次应用隐藏的东西即可。

注意:运行git reset --hard 将删除任何未提交的代码。

If you haven't committed, you should just be able to git stash again, possibly with a git reset HEAD first.

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.

Note: Running git reset --hard will delete any uncommitted code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文