DEV Community

How I restored my deleted file in VSCode: A cool trick you should know 🔮

Krzysztof Platis on July 12, 2024

Hey there! Let me share a crazy experience I had recently. I was working on a lengthy piece of code in a new file in VSCode. After spending hours p...
Collapse
 
senthilkumaranc profile image
SenthilKumaranC • Edited

I have lost of all my files. It got Permanently deleted. Unable to recover from anywhere.

Finally able to recover all files because of this post.

Thanks to you and also to my brother Arvind who pointed out this post.

Thanks to VS code team too.

Collapse
 
e1bos profile image
Luca

I created an account just to thank you.

I had an assignment with a controller file with over 500 lines of code, and I was helping my professor debug a PHP setup error and forgot to rename the dummy file. All my code was gone, I was devastated, went through total shock.

You saved my assignment, my time, and my mental health. Thank you for writing this, for sharing this. I wish the utter best for you.

Collapse
 
krisplatis profile image
Krzysztof Platis

I'm happy it worked for you! 🙌

Collapse
 
laurent_ionesco_a77425eac profile image
Laurent Ionesco

It also works if you worked on a remote server. You opened files through Winscp, you edited them in VS Code (it opened and saved them in a temp directory). If something nasty happened on the server and you overwrote a file, you can recover it with the method here. Thanks Krzysztof!

Collapse
 
krisplatis profile image
Krzysztof Platis

Wow. Awesome you're sharing it! Thanks for info!

Collapse
 
alexantoshuk profile image
alexantoshuk

I accidentally did a git checkout but forgot to commit, all the files were replaced by the old version. Local History helped me restore everything! Thank you!

Collapse
 
wuyen profile image
Wuyen

Thank you , you saved my life

Collapse
 
hashim_hussain_5 profile image
Hashim Hussain

Amazing it works perfectly thanks for info.

Collapse
 
ayyash profile image
Ayyash

you could have just opened the trash bin and restored :) but yes this is easier

Collapse
 
krisplatis profile image
Krzysztof Platis

Good idea. I've tried it too, but the file wasn't in the trash. Likely, because I've accidentally removed it with some git command (but not regular "delete file" action in the system).

Collapse
 
sayidina_ahmadalqososyi_ profile image
Sayidina Ahmadal Qososyi

thanks :")

Collapse
 
dev_named_will profile image
Will

Thank you for the save 🙏

Collapse
 
akintomiwafisayo profile image
akintomiwa-fisayo

You're a superhero, you just saved me from depression 🤗 .

Collapse
 
barry_valizade_4257cf449c profile image
Barry valizade

Thank you, you save my time <3 :)

Collapse
 
abdul_azeez_77598ac9a119d profile image
abdul azeez

You save my day ♥

Collapse
 
rahulkad profile image
Rahul Kadam

You just saved my life. Thanks

Collapse
 
abhishek_waghmare profile image
Abhishek Waghmare

Thank you, you just saved my 2 weeks of work!

Collapse
 
mekdim_tam profile image
Mekdim Tam

thanks bro you saved me

Collapse
 
byiringiriro_fabrice_a891 profile image
BYIRINGIRIRO Fabrice

hhhh life saver I was about to go crazy

Collapse
 
emma_miller_ca3f736a2b808 profile image
Emma Miller

thanks.

Collapse
 
pereafrantz profile image
Frantz Perea Cobos

I just can say... you saved me a day of work.

Collapse
 
rak_acoustic_48e4b738c334 profile image
RAK ACOUSTIC

*Your article saves my day too *