如何恢复/取消 git reset --soft HEAD~20

How to revert / cancel git reset --soft HEAD~20

我想压缩一些提交,我跟着 this 所以我做了:

git reset --soft HEAD~20
git commit
git push -f

我不知道为什么,但现在我的分支充满了以前没有的合并 我想恢复 git reset --soft HEAD~20 命令 如何做呢? 谢谢!!

更新
我做了: git 重置 < 重置前的提交哈希:移动到 HEAD~20 > 然后
git 推 我得到:

error: failed to push some refs to 'https://xxxx@bitbucket.org/xxxx/xxxx.git'
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.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

运行:

git reflog

它将向您显示如下内容:

0475497 (HEAD -> master) HEAD@{0}: reset: moving to HEAD~20
ab155bc HEAD@{1}: commit: commit before reset
5da1f69 HEAD@{2}: commit: commit message
c2d9604 HEAD@{3}: commit: commit message
.
.
.

然后你可以通过使用它的提交散列(在上面的例子中,它是 ab155bc