0

I might have wasted a lot of time. My commit wasn't working because of some warnings saying something about CLRF to LF.

I was looking for a fix and I did

$ rm .git/index
$ git reset --hard HEAD

Following an answer here, it being in the morning, not fully comprehending what it said I executed the commands and my project reverted to my latest commit (which was a while ago because of the warnings I didn't try to fix as soon as I got them).

I got the Xcode alert saying the project changed and if I wanted to revert it or keep the Xcode version, I clicked to keep the Xcode version. As soon as I looked at my project I saw a lot of files were gone, not to be found in the trashcan.

I'm afraid to touch the project or do anything other answers suggest in case I mess it up even more.

It would be devastating if I can not get the files back, anyone got into a similar situation?

The Amateur Coder
  • 789
  • 3
  • 11
  • 33
Bram-N
  • 426
  • 4
  • 15

1 Answers1

0

when git removes an untracked/uncommitted file it's permanently erased so git has nothing to do to recover the file

you can give a recovery tool a try it might help, I'v used EaseUS Mac data recovery personally and it did recover a lot of my work after formatting disk accidentally.

hope it help you, I know that feeling

mina sameh
  • 1,069
  • 7
  • 20