问题重现

使用git reset --hard后,需要恢复至reset前的代码

解决办法

reset前commit了,可通过查看日志,找到hash恢复

  1. 查找日志,找到记录的hash

    1
    git reflog
  2. 查看某记录提交信息

    1
    git log <id>
  3. 恢复

    1
    git reset <id>