0

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!

Markus Meyer
  • 3,327
  • 10
  • 22
  • 35
Millar
  • 1
  • 5
  • Can you explain why you think the files were deleted? – CodeCaster Aug 16 '22 at 11:34
  • Honestly I have no idea, I have done commits like this on the project before. Just this time, after committing and selecting "yes" on the message the files I added before the commit disappeared – Millar Aug 16 '22 at 14:53
  • You really, really, **really** need to work on drastically changing your commit frequency! Start by watching the Woody Zuill and Llewellyn Falco's presentation/demo where they postulate that you should [**never be more than 2 minutes away from checking in and going home**](https://www.youtube.com/watch?v=aWiwDdx_rdo). This does not translate directly to unconditionally commit something every two minutes, but your commit frequency should definitely be massively closer to two minutes than two hours, *extremely seldom* days, and **never** weeks. – hlovdal Aug 16 '22 at 16:12
  • Yeah, I guess you never learn until something like this happens, I did naturally lower my commit time from never to months, and then to weeks and thought that was okay since nothing like this ever happened. Will commit more often now :( – Millar Aug 17 '22 at 07:06

1 Answers1

1

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).

CodeCaster
  • 147,647
  • 23
  • 218
  • 272