如何从 "git push -f origin HEAD^:master" 命令中恢复?

How to recover from the "git push -f origin HEAD^:master" command?

我正在寻找一种方法来删除我最后的 GitHub 提交,并在以下位置找到了这个命令:

How can I remove a commit on GitHub?

成功了。问题是我不小心弄错了仓库。

我在评论中看到提交并没有真正被删除,但是

"...this only moves the branch pointer."

如何从此命令中恢复并恢复到上次提交?

GitHub 有一个隐藏的 reflog:GitHub Events API.

参见“

通过卷曲 https://api.github.com/repos/<user>/<repo>/events 并查找推送事件,您可以找到在您自己之前推送到 master 的提交,并再次推送该提交,前提是您有该存储库的本地克隆。