失去了最后的Git提交 [英] Lost Last Git Commit
问题描述
我失去了最后一次提交,因为我意外地运行了git reset --hard HEAD ^。注意:我不想在最后加上^。
I lost my last commit because I accidentally ran "git reset --hard HEAD^". Note: I didn't want to put the "^" at the end.
有什么方法可以恢复吗?这是2天的工作:(
Is there any way to get it back? It was 2 days of work :(
推荐答案
我认为这篇文章是你正在寻找的。根据文章,你的提交是走了,但没有收集垃圾 - 有点像Windows中的回收站。
I think that this article is what you are looking for. According to the article, your commit is "gone," but not garbage collected - sort of like the recycle bin in Windows.
运行 git fsck --lost-found
来查找'dangling commit',然后用 git reflog
来查看它,然后将悬而未决的提交与您当前的分支 git merge 7c61179
。
You run git fsck --lost-found
to find the 'dangling commit', and look at it with git reflog
, then merge the dangling commit with your current branch, git merge 7c61179
.
这篇关于失去了最后的Git提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!