When I was coding one project this morning, I accidentally use "git reset hard" to reset my commits. As I had a lookup on SO and tried some recovery option. It brought me to this step. I need to get back to the commit "2070cc5 HEAD@{9}" but truly don't know how. What my terminal displays:
Asked
Active
Viewed 148 times
-1

Vadim Kotov
- 8,084
- 8
- 48
- 62

Chase Chung
- 3
- 3
-
Did you try `git checkout HEAD@{9}`? – Nathan Mills Sep 21 '20 at 02:20
-
Already answerd here: https://stackoverflow.com/questions/5788037/recover-from-git-reset-hard – Philippe Sep 21 '20 at 10:18
1 Answers
1
1.make sure you working directory clean
2.if it's not clean, you can use execute git stash
command to make it clean
3.execute git reset --hard 2070cc5
, that's what you want
4.you might need to execute git stash pop
to get the previous changes in working directory

Chuck Lu
- 173
- 12