Ismail Mechbal

Restoring lost commits

23 September 2018

You just did git reset --hard HEAD^ and all your last commit went to trash.

Luckily we can still get them if you did not run git gc (git garbage collection to clean it up), but who really does :p.

git fsck –lost-found

git reflog

git merge latest commit HASH

Thank goodness!

← Back to all articles