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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With