简体   繁体   English

丢失了git commit

[英]Lost a git commit

I have the hash for a git commit I made a few weeks ago. 我有几周前进行的git commit的哈希。 I tried checking it out but it says that the hash "did not match any file(s) known to git". 我尝试将其签出,但是它说哈希“与git已知的任何文件都不匹配”。 I also looked for it in git reflog, but don't see it there. 我也在git reflog中寻找了它,但是在那里没有看到它。 I don't see the earliest commits I made in reflog either. 我也没有在reflog中看到最早的提交。

I couldn't find the missing commit in my remote repository in Gitorious either. 我在Gitorious的远程存储库中也找不到丢失的提交。 However, I do see the earliest commits I made in Gitorious, just not the one I'm looking for. 但是,我确实看到了我在Gitorious中所做的最早的提交,只是没有找到我想要的。

Well, the commit no longer exists in your database, which is unfortunate. 好吧,不幸的是,提交不再存在于您的数据库中。 Start with a git lost-found just in case you have the hash wrong. git lost-found开始,以防万一您弄错了哈希。

If it disappeared because it was garbage collected, you're out of luck. 如果由于垃圾收集而消失了,那您就不走运了。 If it disappeared for any other reason (disk corruption, file system bug, etc.), you may still be able to find the blobs that were in that commit. 如果由于任何其他原因(磁盘损坏,文件系统错误等)而消失,您仍然可以找到该提交中的Blob。

git fsck can tell you if there are any problems with git's internal database. git fsck可以告诉您git的内部数据库是否存在任何问题。 If that doesn't turn up anything, try this: How to recover LOST WORK resulting from the use of git? 如果仍然无法解决问题,请尝试以下操作: 如何恢复由于使用git而导致的LOST WORK?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM