用 Git Reflog 來還原
在使用 git 的時候若是在 remote 的 repo 沒有保存到就直接將 local 的 branch reset ,此時可以使用 git reflog 來還原。
可以看到這邊目前的 HEAD 是在 862c7dd
接著我使用了 git reset --hard HEAD^
來回到上一個 commit,但是這時如果我們忘記把原本的 commit 推到 remote 的話也不要慌張,這時可以使用 git reflog
救回來。
下 git reflog
可以看到 git 的操作
這時我們在使用 git reset
回去