如何还原不必要的"git reset HEAD〜1"? [英] How to revert an unnecessary "git reset HEAD~1"
本文介绍了如何还原不必要的"git reset HEAD〜1"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
运行git reset HEAD~1
之后,我注意到实际上没有其他事情可做,并且提交很好.有没有办法还原此命令?
After running git reset HEAD~1
, I noticed that actually there was nothing else to do and the commit was fine. Is there a way to revert this command?
推荐答案
您可以使用:
git reset HEAD@{1}
这使用引用日志中的最后一个条目.如果您在之间进行了其他操作,请参见git reflog
.
This uses the last entry in the reflog. See git reflog
if you did other things in between.
这篇关于如何还原不必要的"git reset HEAD〜1"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文