I was searching for a way to remove my last GitHub commit and found this command on:
How can I remove a commit on GitHub?
It worked. The problem is that I accidentally did it to the wrong repository.
I read in comments that commit is not really deleted, but
"...this only moves the branch pointer."
How can I recover from this command and revert to the last commit?
GitHub has an hidden reflog: the GitHub Events API.
See "Does github remember commit IDs?"
By curling the https://api.github.com/repos/<user>/<repo>/events
, and looking for push events, you can find the commit pushed to master before your own, and push again that commit, provided you had a local clone of that repo.