Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you undo "Discard all changes" in VS Code/Git

I fear I already know the answer but here goes anyway.. I accidentally clicked "Discard All Changes" in VS Code (OSX) and now a month's worth of work is gone. Poof'd. Thing is, I didn't have GIT properly setup so I hadn't done any commits yet. Is there anyway I can get my work back? Right now my working directory is as good as empty..

[edit] I should clarify, the console log says it did a "git clean -f -q" which would mean the files are gone. But I was wondering if VSCode maybe has a backup or history or cache.. or anything. I'm desperate..

like image 614
user1026622 Avatar asked Apr 21 '17 11:04

user1026622


People also ask

How do you undo discard all changes in VS code?

Ctrl + Z or restore from trash. I have lost work to this multiple times, and to remedy this, I commit all the changes, then reset the branch to the previous commit.

How do I revert back the changes in VS code?

Click the (...) button and then select Undo Last Commit to undo the previous commit. The changes are added to the Staged Changes section.


1 Answers

After accidently pressed discard changes btn on the wrong file, and I ended up here) Having not found the way to restore, I have tried simple CMD+Z (CTRL+Z) in that file, and boom - everything is back, so dont give up and try that :) Very pleased

like image 89
YEVY Avatar answered Sep 21 '22 18:09

YEVY