恢复交互式git rebase

Reverting an interactive git rebase

在完成了一个功能分支之后,在git rebase -i期间,我意外地删除了所有提交。我不完全确定,但我怀疑我并没有压扁提交,而是用提交消息替换了整个条目。

http://shafiulazam.com/gitbook/4_interactive_rebasing.html说:

The last useful thing that interactive
rebase can do is drop commits for you.
If instead of choosing 'pick',
'squash' or 'edit' for the commit
line, you simply remove the line, it
will remove the commit from the
history.

我的问题是:是否有方法恢复/撤消此操作?


如果你需要做的只是"rebase,你可以试着在mentioned睾丸: P / < >

1
git reset --hard ORIG_HEAD

世纪Jakub NAR吗?bski的细节: P / < >

ORIG_HEAD is previous state of HEAD, set by commands that have possibly dangerous behavior, to be easy to revert them.
It is less useful now that Git has reflog: HEAD@{1} is roughly equivalent to ORIG_HEAD (HEAD@{1} is always last value of HEAD, ORIG_HEAD is last value of HEAD before dangerous operation).

如果你有一些executed运营以来,"rebase,reflog仍然能提供帮助。 P / < >


你可以做"蠢货reflog"和回到你的旧的头。 P / < >