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.

0

1 Answer 1

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.