执行后如何恢复:git reset --hard HEAD [英] How to recover after i execute :git reset --hard HEAD

查看:1100
本文介绍了执行后如何恢复:git reset --hard HEAD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我犯了一个可怕的错误,执行git reset --hard HEAD,整天的本地修改失败了,我该如何恢复它?

I made a terrible mistake and execute "git reset --hard HEAD", all day's the local modification lost, how can i recover it?

感谢数百万美元

Thanks millions

推荐答案

如果您尚未提交您的本地修改(或者至少是通过 git add 来完成),它们已经不存在了。 git reset --hard 是一个对于未提交的更改会造成破坏性的操作。

If you didn't already commit your local changes (or at least stage them via git add, they're gone. git reset --hard is a destructive operation for uncommitted changes.

如果您确实碰巧将它们暂存,但未提交它们,请尝试 git fsck --lost-found ,然后搜索 .git / lost-found 的内容 - 它将包含所有未被已知提交引用的对象,并可能包含已上演文件的版本。

If you did happen to stage them, but didn't commit them, try git fsck --lost-found and then search through the contents of .git/lost-found - it will contain all of the objects that aren't referenced by a known commit, and may include versions of files that were staged.

这篇关于执行后如何恢复:git reset --hard HEAD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆