2

I mistakenly discarded 10000 commits from the vscode and all files got deleted from my personal mac folders where all my important documents were saved. My icloud folders are all empty. what can I do to restore all files?

I am attaching picture below with the steps how I discarded all the 10000 commits.

VSCode

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Tanuja
  • 21
  • 2
  • 2
    How have you determined that you lost those commits? When you say "commit" you're talking about git commits and not files right? If we are indeed talking about git commits and you reset your branch to lose track of those commits, you can probably recover that by looking at the reflog for that branch. If you actually mean files and they were previously committed, you should be able to restore the files for that branch. If you never committed them in the first place, then they're probably lost. Otherwise, you'll need to provide more details on what you mean. – Jeff Mercado Jul 15 '22 at 04:08
  • 1
    And of course, _never_ run `git gc` until after this episode is resolved - and in fact, you should immediately make a copy of your repo's `.git` directory to another volume to prevent further possible data-loss. – Dai Jul 15 '22 at 04:10
  • From the screenshot you didn't discard commits but local changes and sadly there is no way to restore them. – zigarn Jul 15 '22 at 04:54
  • 1
    Looks like you made a Git repository out of your entire home folder, then discarded everything that wasn’t committed? Unless they were staged first, Git won’t have backup copies of those files. You need to use file recovery software and/or iCloud’s “recently deleted”. https://support.apple.com/en-ca/guide/icloud/mmae56ea1ca5/icloud – Ry- Jul 15 '22 at 04:55

1 Answers1

1

Those are local modifications (not yet committed).

A recent VSCode should have timeline activated, which means recreating the file even empty should show you its associated timeline, allowing you to restore its local content.

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