硬重置后最新的提交失败了 [英] The latest commit gone after hard reset
问题描述
我提交了更改,但没有将其推送到服务器。然后,我确实重新设置了我之前的一个提交,并且我的最新提交没有了。是否意味着在硬重置后没有被推送到服务器的提交?
编辑:
是否有可能恢复我的最新提交?
是的,但不是马上。
Reflog条目将及时过期,并且内容将在垃圾回收中消失。
您仍然可以从引用日志中取回它们:
git reflog
$
$ g $ git reset HEAD @ {1}
或者,例如将它签出到 rescue 分支:
git checkout -b rescue HEAD @ {1}
I commited my changes and didn't push them to the server. Then I did hard reset to one of my previous commits and my latest commit gone. Does it mean commits which weren't pushed to server gone after hard reset?
edit: Is it possible to recover my latest commit?
Yes, but not immediately. Reflog entries will expire in time and the contents will disappear on garbage collection.
You can still get them back from the reflog:
git reflog
and reset to them/checkout:
git reset HEAD@{1}
or, e.g. checking it out to a rescue branch:
git checkout -b rescue HEAD@{1}
这篇关于硬重置后最新的提交失败了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!