-1

For the record I am a novice programmer currently taking Harvard's free Game programming course, and my computer is a Mac. I know how to use Git to submit something, but I'm not aware of all the intricacies and I become completely lost when I see technical terms being thrown around.

I started doing an assignment in visual studio code, and get a warning that I have more than 5000 untracked changes whatever that means. I go to the source control window and delete all changes, thinking that it would make the problem go away. Now all of my files that were on my desktop, and any that were in folders on my desktop are gone. Is there anyway to reverse this? What does source control even do, and why can it delete files you aren't currently editing? It looks like it has something do with git, but I'm completely lost as to how this happened.

Gabriel Bruno
  • 15
  • 1
  • 3
  • Does this answer your question? [How do you undo "Discard all changes" in VS Code/Git](https://stackoverflow.com/questions/43541167/how-do-you-undo-discard-all-changes-in-vs-code-git) – max630 Jun 21 '20 at 11:01

1 Answers1

2

What seems to have happened is that you ran git init in the desktop folder and not inside the actual project folder, which made the git project include the entire desktop. VSCode then informed you that all those files were untracked, i.e. you hadn't yet added those files to git yet. To "fix" the problem you then deleted those files without looking what they were.

why can it delete files you aren't currently editing?

It didn't, you did.

Is there anyway to reverse this?

Yes, restore the files from your backup. If you don't have one, this is a good although unfortunate reminder that you always need to have backups. On a Mac setting it up with Time Machine is trivially easy so there's no excuse not to do it.

Guy Incognito
  • 344
  • 2
  • 6
  • 10
  • I didn't run git init before opening VSC though... Last time I used git was to submit the previous assignment. And no, I don't have a backup... I'll set one up now, thank you. – Gabriel Bruno Jun 21 '20 at 07:31