I will explain what I have done, which seems to have destroyed a folder with files I was working on.
I have a git project, which is fine, and I also have a folder (outside this git project, and no part of any git project) where I had some scripts and some files I generated. I wanted to integrate this folder into the git project, so I moved it there to a right location.
I did a git status, and it said that the new folder was untracked, so I did a
git add newfolder
I then did a git status
, and it showed hundreds of pickle *.p files which I had moved, but that I didn't want to commit or push these to the server. So I created a new .gitignore
file to ignore these .p
files.
I checked git status
again, but it was too late, and the .p
files where already there, so this is when I did my first mistake. I thought "I should undo the last commit" (even though I never committed about adding this new folder so far) and I did
git reset --hard HEAD^
After this I did a git status
and it said I was a pull behind (some changes I did yesterday to that git project) so I did git pull
.
After this, all the files in newfolder
disappeared. The only thing still around are the folders I had inside (empty) and some hdf5 files I had in the root .gitignore
.
So my question is, is there any way to recover newfolder
?