Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cancel undo commit VSCode

Accidentally I press Undo Commit and all my work dissappeared, Is there any way to revert it? I didn't commit my last changes and that is the work I lost

like image 410
Pablo Escobar Avatar asked Oct 27 '25 08:10

Pablo Escobar


1 Answers

As mentioned here, VSCode "Undo Last Commit" runs git reset HEAD~.

That means you can restore your last commit (but not easily your work in progress at the time of the undo) using git reflog, and a git reset --hard <lastSHA1> (again, make sure you don't have a work in progress, use git stash if needed).

However, for any work in progress, you will need the VSCode local history as mentioned in the comments.

like image 74
VonC Avatar answered Oct 28 '25 23:10

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!