如何重置上次恢复的存储,但随后错误地丢失了其中包含的更改?
我当时使用 GitHub 桌面并恢复了我的存储,但当我继续工作时,错误地覆盖了这些更改,而这种方式无法使用 VS Code 恢复。 (使用 crtl+z 返回文件历史记录,然后错误地覆盖了这些更改)。
即使没有被丢弃,有什么方法可以带回藏匿物吗? 我在 Windows 10 上尝试了以下命令,但我认为它只列出了删除的存储提交: git fsck --no-reflogs | 理想情况
下,我需要一种方法来列出所有最近的存储提交,无论它们是被删除还是恢复。然后使用 git stash apply *hash* 恢复它们。
总结:下图中的恢复按钮是我单击的将存储应用到本地存储库的按钮。但是,现在我丢失了那些恢复的更改。我想取回我的藏品,以便恢复这些更改,因为这似乎是我能做到这一点的唯一方法。
I was using GitHub desktop and restored a stash I had, but then as I went on with the work and mistakenly overwrote those changes in a way that cannot be recovered using VS Code. (used crtl+z to go back in the file history, then overwrote those changes by mistake).
Is there a way I can bring back the stash even though it was not discarded ?
I am on Windows 10, tried the following command, but I think it only lists the dropped stash commits : git fsck --no-reflogs | find "dangling commit"
Ideally I would need a way to list all recent stash commit regardless if they were dropped or restored. Then recovering them with git stash apply *hash*
.
In summary : The restore button in the picture below is what I had clicked on to apply the stash to my local repository. However, now That I lost those restored changes. I want to get back my stash so that I recover those changes, as it seems the only way I can do so.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我能够使用以下命令恢复存储:
git fsck --unreachable | grep 提交 |切 -d ' ' -f3 | xargs git log --merges --no-walk
请注意,在堆栈溢出上发布问题之前我已经尝试过此操作,但是 Windows 无法识别这些命令,因为它们是 Linux 命令。为了解决这个问题,我安装了 cygwin,它允许您在 Windows 中使用 linux 命令:
I was able to recover the stash using the following commands :
git fsck --unreachable | grep commit | cut -d ' ' -f3 | xargs git log --merges --no-walk
git show *hash*
using one of the hashes listed in previous commandgit stash apply *hash*
.Note that I had already tried this before posting the question on Stack overflow, but windows had not recognized those commands because they are Linux commands.To solve this, I installed cygwin which allows you to use linux commands in windows :
ls
command. If it lists your directories folders and files, it means that your configuration was successful.