So I added a remote, empty repository to a local repository that was just initialized, and made the mistake of pulling before committing my local changes:
git init
git remote add origin <URL>
git add *
git pull origin master
Now all my files have been removed because git wrote the empty repo into the local one.
Normally, when pulling, git refused to merge if there were unstaged local changes that needed committing. I'm surprised that this is different with the initial commit.
git log
shows only the initial commit since I never committed the local changes, so I can't undo the pull using git reset --hard
. Is there a way to restore my files and if so, how?