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
Asked
Active
Viewed 79 times
4
-
VS Code keeps track of your [local history](https://code.visualstudio.com/updates/v1_66#_local-history) independent of source control. Can you recover some changes from it? – AnsonH Jan 02 '23 at 04:29
-
Yes it does, but the problem its that I need to restore a complete folder, not file by file @AnsonH – Pablo Escobar Jan 02 '23 at 04:40
1 Answers
3
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.

VonC
- 1,262,500
- 529
- 4,410
- 5,250