问题描述
我试图用 git stash pop
来恢复存储内容。有一些合并冲突,而不是解决它们,我决定重置它。不幸的是,在一片愚蠢的时刻,我做了一个 git reset --hard
,现在所有先前隐藏的更改都没有了。
I had some changes in the stash that I attempted to recover using git stash pop
. There were some merge conflicts, and rather than resolving them, I decided to just reset it. Unfortunately, in a moment of stupidity, I did a git reset --hard
, and now all of the previously stashed changes are gone.
有什么方法可以恢复这些更改?我已经尝试了 git fsck --cache --no-reflogs --lost-found --unreachable HEAD
,但没有列出的提交哈希引用了我需要的更改。我还可以做些什么?或者我只是失去了所有这些工作?
Is there any way to recover these changes? I've tried git fsck --cache --no-reflogs --lost-found --unreachable HEAD
, but none of the commit hashes listed refer to the changes I need. What else can I do? or did I just lose all of that work?
推荐答案
刚发布这个,我想检查.git / refs / stash ,这在流行后我认为会是空白的。然而,可能是由于合并冲突,它仍然存在我试图弹出的存储哈希!
Just after posting this, I thought to check .git/refs/stash, which I thought would be blank after the pop. However, likely due to the merge conflict, it still had the hash from the stash I had tried to pop!
我做了一个 git存储应用
用散列和 git reset
来解决合并冲突的懒惰方式。
I did a git stash apply
with the hash and a git reset
to resolve the merge conflicts the lazy way.
对不起,如果这是一个git-noob问题和答案。希望这可以帮助别人。
Sorry if this was a git-noob question and answer. Hopefully this helps someone else.
这篇关于撤消git reset - 在git隐藏弹出窗口后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!