VSCode deleting staged commits

398 Views Asked by At

I have been working on a project for a week and a half now, went to commit my changes and this message popped up:

Warning message:
Warning message

I selected "Yes". After which VSCode seemed to have deleted all my files that were added to the branch I was working on. I have tried the "Undo previous commit" option, however that only undo's my commit before, not the current one. I have no way of getting these files back (As far as I can see from what I have googled). Has anyone had a similar issue? My files aren't on the server repository or in recycle bin, they have just vanished.

Any Suggestions would be greatly appreciated!

1

There are 1 best solutions below

0
CodeCaster On

Any Suggestions

Commit multiple times per day, not per month. You can always rebase interactively and reorder and squash minor commits.


That being said, assuming the rest of your description is correct (so the files were actually deleted, and not committed), you need to stop working on that disk right now.

Don't save anything, don't switch branches, don't open or close any applications, don't restart your machine.

Download TestDisk (or any other filesystem recovery tool) to another drive (preferably an USB drive on another computer) and try to recover the deleted files to another partition (or USB drive).