I was setting up my first git repository and did the following,
git init
follow by some git-config stuff to setup the remote server. I then did
git add directory
git status
Whoops, I added some files which I did not want. Okay, so I should git rm to remove the directory from the commit list and start again
git rm directory
At this point I should have read the console message and documentation properly....but didn't. So I ran
git rm directory -r -f
Huh? Where did my directory go? Ah, okay, git has removed it so it is "not there" any more. So lets try,
git status
git reset --hard
After no success, some error messages and a bunch of web searches, I realised my faux pas. I should have used
git rm -r --cached directory
which would have removed it from the commit list, but not from my file system. Whoops. Fortunately nothing serious lost.
It seems like there should be a way to recover from this, but most of my searches end up pointing to the "--cached" option...and it is a bit late for that. There are no commits, so I can't just revert/pull the files (there was only a local copy).
Is it possible to get those files back?