I am working in a MacOS with VSCODE.
I have a remote repository on gitlab.
I lost all of my files that were not tracked (all files in git ignore)
I cannot remember exactly what commands led to this incident, but I assume it might have been "git fetch".
I tried looking at my MacOS trash, but the files are not there. I don’t know where else to look.
2
Answers
VS code keeps a local history.
Command+P > Local History: Find entry to restore
git fetch
will not kill untracked files unasked.There are very little really destructive commands in Git that cannot easily be undone and the ones that are there are usually not called accidentally.
One possibility that could have deleted the untracked files would be
git clean -fdx
(force, also directories, also excluded files).If those untracked files are gone, Git can not do anything for you as the files were untracked and Git does not know what was in them. That’s why it is super careful not to delete them and for example warns you prominently if a switch or merge or whatever would touch untracked files.
You have to check whether you have some backup, or macOS timemachine, or whether the local history that was mentioned can provide the files you lost. If not, there are little chances besides using a disk-restore utility.