See VonC's answer above - I needed an extra step:
$ git log -1
- note the SHA-1 of latest commit
$ git checkout master
- reset your branch head to your previously detached commit
$ git reset --hard <commit-id>
I did this, but when I then tried to git push remoterepo master
, it said
"error: failed to push some refs. To prevent you from losing history, non-fast-forward updates were rejected, Merge the remote changes (e.g. 'git pull') before pushing again."
So I did 'git pull remoterepo master', and it found a conflict. I did git reset --hard <commit-id>
again, copied the conflicted files to a backup folder, did git pull remoterepo master
again, copied the conflicted files back into my project, did git commit
, then git push remoterepo master
, and this time it worked.
Git stopped saying 'everything is up to date' - and it stopped complaining about 'fast forwards'.