Pablo Escobar
Pablo Escobar

Reputation: 95

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

Upvotes: 4

Views: 354

Answers (1)

VonC
VonC

Reputation: 1329092

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.

Upvotes: 3

Related Questions