restore - git reset --hard HEAD^

后端 未结 2 2125
被撕碎了的回忆
被撕碎了的回忆 2021-02-14 00:03

Unfortunately I did several times git reset --hard HEAD^ losing a quite big chunk of code in several files. Is there a way to restore those commits or in this case

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-14 00:53

    Run git reset --hard HEAD@{1} if you just committed your code and you want to undo that.

    See Section called "Ordinal Spec" at http://book.git-scm.com/4_git_treeishes.html

提交回复
热议问题