A few days ago, I checked out an older version of my app to go back in time to before I'd added some features that blew up the whole app.
I don't think I made a branch at that time, and instead just did: $ git checkout 61d8a79
where 61d8a79 was the last good version from GitHub
I now think I realize from How to revert Git repository to a previous commit? that this was a mistake, and I should have made a branch.
For the past several days, I've been working in ((detached from 61d8a79)) myApp
I realized my mistake and wanted to make my local version the version at origin, so I looked at my git log, saw 508b4f0 was the most recent version and tried
$ git push origin 508b4f0:master
This yielded the error msg: ! [rejected] 508b4f0 -> master (non-fast-forward) error: failed to push some refs to 'git@github.com:username/myApp.git' hint: Updates were rejected because a pushed branch tip is behind its remote hint: counterpart. Check out this branch and integrate the remote changes hint: (e.g. 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Then I tried: $ git push origin 508b4f0
and got: fatal: 508b4f0 cannot be resolved to branch.
Any advice on how to not lose my work & get my current version back on GitHub would be great.
I'm a bit afraid to "pull" b/c my origin is days behind my local version...
For background: I am working on this app by myself, and just using to GitHub to (1) backup my files and (2) start learning how it works so I'm better prepared to work with others in the future.
Thanks!