I think I might have screwed my days work but I did this chain of commands
git status
git add .
git rm filename1
git rm filename2
I then stupidly thought why am I doing this one by one I know there is a way to do it all at once
git rm -r -f
working directory gets wiped I realised I have messed up and then tried
git checkout -f
which restored everything to my last commit which was this morning.
I am looking at these answers and thinking there might be a way but I dont understand those answers well enough to risk trying anything yet, any advice?
Based on the linked answers, everything that you added to index with git add
should be possible to recover with:
git fsck --lost-found
This will create the files that you added to the index but never committed in the .git/lost-found/other
directory. The filenames will be SHAs instead, so you will have to look inside one by one to know which is which.