0

I deleted a commit accidentally using:

git reset --hard HEAD~1

I want to know if there is a way I can revert this and recover my commit. Thanks for your help.

svelandiag
  • 4,231
  • 1
  • 36
  • 72

1 Answers1

2

Ho I find the answer! I did not knew I can use git reflog it will show your all your commits included the deleted commits, then you can reset to it like:

git reset HEAD@{N}

Where N is the number that reflog shows you.

svelandiag
  • 4,231
  • 1
  • 36
  • 72