Recover from git reset --hard?

后端 未结 22 2559
盖世英雄少女心
盖世英雄少女心 2020-11-22 00:52

Is there any way to recover uncommitted changes to the working directory from a git reset --hard HEAD?

22条回答
  •  闹比i
    闹比i (楼主)
    2020-11-22 01:43

    if you accidentally hard reset a commit, then do this,

    git reflog show
    git reset HEAD@{2} // i.e where HEAD used to be two moves ago - may be different for your case
    

    assuming HEAD@{2} is the state you desire to go back to

提交回复
热议问题