What is behavior of git reset
, specifically git reset --hard
, while tree has no commits yet? (Just after git init
). It just deletes everything?
Messed it up, while editing .gitignore.
I tried to apply new changes to .gitignore, before making first commit. So, to ignore some new files, I had to clean index, and then make git add .
again. I guess, plain git reset
whouldn't do the mess, but I used git reset --hard
, due to my geniusness.
Now, the project folder contains only .git folder with contents, and also the whole folder structure of a project, but without any files. Why?
Can I recover the files? What are my options in this case?
UPD
@kowsky pointed me in right direction - in this answer they explain how to recover files, that are temporarily stored in .git/objects
(dangling blobs), like in my case (particularly, using this tool).
I recovered everything, thank you!