I just made a new repository on github. Starting with a folder full of files, the steps I did were:
git init
git add -A
git remote add origin ...
#Now pull
I did the similar thing When I was trying to push my commit and was getting hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again.
I tried to revert my commits by
git reset HEAD~3 .
git stash
git pull
git stash pop
git push
and accidentally pulled again and push the changes. All my work for 7 days was lost.
This worked for me to get all of my work back in local branch:
git reset --hard HEAD@{"15 minutes ago"}