我更改了一些文件和一些新文件
git pull
: 说我在几个文件中有冲突
我做到了:
git stash
git pull
git stash pop
我预计会发生冲突,但没有发生。
相反,许多文件现在只是空的。 当前未提交的更改显示从这些文件中删除的所有内容。
我看到的解决方案是:克隆存储库。 “以某种方式恢复”我最后 pop 的存储并将其保存为补丁并在那里应用。
我如何恢复它(它不再在 stash 列表中)
我没有看到最后的存储使用:
gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
和
git fsck --no-reflog | awk '/dangling commit/ {print $3}'
给出:
error: object file .git/objects/02/7745a5151a6237eb1dcd8e4f0df10328809669 is empty
error: object file .git/objects/02/7745a5151a6237eb1dcd8e4f0df10328809669 is empty
fatal: loose object 027745a5151a6237eb1dcd8e4f0df10328809669 (stored in .git/objects/02/7745a5151a6237eb1dcd8e4f0df10328809669) is corrupt
我该怎么办?发生了什么事?
最佳答案
我发现官方文档有解决办法。
Recovering stash entries that were cleared/dropped erroneously
If you mistakenly drop or clear stash entries, they cannot be recovered through the normal safety mechanisms. However, you can try the following incantation to get a list of stash entries that are still in your repository, but not reachable any more:
git fsck --unreachable |
grep commit | cut -d\ -f3 |
xargs git log --merges --no-walk --grep=WIP
关于git - git stash pop 成功后如何恢复我的 git stash,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35186393/