好的,这次我在GIT上真的搞砸了:我离线工作了几天的一个项目,今天尝试提交/推送更改到GitHub。不知何故,出现了一些冲突,我试图用rebase解决。最终我处于REBASE 1/2分支中,使用了跳过选项并移动到REBASE 2/2,再次跳过...嗯,你猜怎么着?我搞砸了,以至于我用最新提交到GitHub的内容覆盖了我的本地项目,损失了11天的工作!
现在,既然我确定在rebase之前已经暂存和提交了我的更改,我认为有一种方法可以恢复这场灾难;但是当我用git reflog检查时,这是顶部行:
2e73363 HEAD@{0}: rebase finished: returning to refs/heads/master
问题是,这个提交号是11天前的,而不是今天的!
所以我的问题是: - 我今天的提交在哪里? - 是否有任何方法可以还原我今天所做的rebase,将所有更改恢复到项目中?
编辑:这是来自reflog的完整文本:
$ git reflog
2e73363 HEAD@{0}: rebase finished: returning to refs/heads/master
2e73363 HEAD@{1}: rebase: checkout origin/master
2ff234f HEAD@{2}: commit: added .classpath to commit
8ddcf79 HEAD@{3}: commit: fixed few errrors
e5a6da9 HEAD@{4}: commit: adding hibernate to DAO classes
c6c10bf HEAD@{5}: commit: fixed problems with commit after detached head
0e527a6 HEAD@{6}: commit (merge): added Spring Security
f4ad11a HEAD@{7}: checkout: moving from tmp to master
a0a1597 HEAD@{8}: checkout: moving from master to tmp
f4ad11a HEAD@{9}: checkout: moving from new-branch to master
f4ad11a HEAD@{10}: checkout: moving from master to new-branch
f4ad11a HEAD@{11}: checkout: moving from master to master
f4ad11a HEAD@{12}: checkout: moving from 96e7903b784ae435c042abab33939327b081c138 to master
96e7903 HEAD@{13}: checkout: moving from master to 96e7903b784ae435c042abab33939327b081c138
f4ad11a HEAD@{14}: checkout: moving from a0a1597361522b25f4c12463f1bfa2673721eb7b to master
a0a1597 HEAD@{15}: checkout: moving from master to a0a1597
f4ad11a HEAD@{16}: checkout: moving from a0a1597361522b25f4c12463f1bfa2673721eb7b to master
a0a1597 HEAD@{17}: commit: commit from detached head
c40dc30 HEAD@{18}: commit: added Spring Security to admin page
96e7903 HEAD@{19}: checkout: moving from master to 96e7903b784ae435c042abab33939327b081c138
f4ad11a HEAD@{20}: revert: Revert "commicommitt"
96e7903 HEAD@{21}: checkout: moving from 96e7903b784ae435c042abab33939327b081c138 to master
96e7903 HEAD@{22}: checkout: moving from master to 96e7903b784ae435c042abab33939327b081c138
96e7903 HEAD@{23}: commit: commicommitt
f9fc7a1 HEAD@{24}: merge refs/remotes/origin/master: Fast-forward
ff7fc6d HEAD@{25}: commit (initial): Initial commit
这是从reflog主分支中输出的结果:
$ git reflog master
2e73363 master@{0}: rebase finished: refs/heads/master onto 2e7336369502768f42174019bf1efbfc9b113d9f
2ff234f master@{1}: commit: added .classpath to commit
8ddcf79 master@{2}: commit: fixed few errrors
e5a6da9 master@{3}: commit: adding hibernate to DAO classes
c6c10bf master@{4}: commit: fixed problems with commit after detached head
0e527a6 master@{5}: commit (merge): added Spring Security
f4ad11a master@{6}: revert: Revert "commicommitt"
96e7903 master@{7}: commit: commicommitt
f9fc7a1 master@{8}: merge refs/remotes/origin/master: Fast-forward
ff7fc6d master@{9}: commit (initial): Initial commit