How to recover after i execute :git reset --hard HEAD

后端 未结 6 786
梦如初夏
梦如初夏 2020-12-31 11:37

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

6条回答
  •  一向
    一向 (楼主)
    2020-12-31 12:02

    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.

    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.

提交回复
热议问题