undo dropped commit in sublime merge

3.3k Views Asked by At

I just switched to sublime merge away from github desktop (what an improvement), however I just performed the menu option Edit commit\drop selected commits thinking it was the equivalent of the undo commit button in github desktop.

That has not undone the commit I had selected (which was the most recent in the tree) as I thought, it has dropped (erased) it completely.

I know there are many posts discussing the reflog and of course I'll study that but would love a direct (command line if necessary) solution which fixes this exact problem first, then I can learn more later.

1

There are 1 best solutions below

1
iBug On

Assume the "drop last commit" actually did something like git reset --hard HEAD~, you may have amsome chance retrieving the dropped commit via ORIG_HEAD. That says, try giving this command a try and check your luck:

git log -3 ORIG_HEAD

If you can recall the commit message, applying git log on every output of git fsck --dangling will 100% find that commit out for you, provided you haven't done a git gc.