自重组开始以来,中止了旧的git rebase并失去了提交 [英] Aborted old git rebase and lost commits since the rebase started

查看:106
本文介绍了自重组开始以来,中止了旧的git rebase并失去了提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

扯淡!大约一个星期前,我试图清理我的存储库时重新绑定了一些提交,显然我没有真正完成它。今天,接下来的一周和几次提交,我从今天开始重新订购一些提交,并告诉我我已经在进行重新设计。



这应该是为了防万一复制我的回购。但是我没有......相反,我运行了 git rebase --abort ,这在当时听起来很正确。那是不对的。它从一周前中止了重新设定,并将主人的头部重置为旧的头部。假的!



我还有其他几个分支机构相当近,我已经多次推送到远程,但最近的更改似乎永远消失了。我没有适当的git-fu级别来知道是否有任何方法可以恢复我的更改。



我拧了吗?



编辑 - WOW!多谢你们! git reflog 太棒了!我完全康复了...吸取了教训。标记Tchalvak的答案被接受为第一个发布。

解决方案

检查 git reflog 。在几乎所有情况下,您都可以使用这些提交散列作为参考。



我还将其他地方的git repo目录复制到一个地方做初步测试,看看会发生什么,这样你就可以随心所欲地乱用任何你想要的东西而不会丢失未跟踪的文件或将事物置于无法返回的状态。


Crap! About a week ago, I was rebasing some commits while trying to clean up my repository, and apparently I didn't actually finish it. Today, a week and several commits later, I went to rebase to reorder a few commits from today, and it told me I was already in the middle of a rebase.

That should have been a cue to copy my repo just in case. But I did not...instead I ran git rebase --abort which sounded right at the time. Well, that was not right. It aborted the rebase from a week ago and reset master's HEAD to the old one. Dummy!

I've got several other branches that are fairly recent, and I've pushed to remote several times, but the most recent changes appear to be gone forever. I don't possess the appropriate level of git-fu to know if there's any way to recover my changes.

Am I screwed?

EDIT - WOW! Thanks guys! git reflog is awesome! I'm fully recovered...lesson learned. Marking Tchalvak's answer accepted for being the first to post.

解决方案

Check git reflog. You can walk back in time using those commit hashes as a reference in almost all cases.

I'd also physically copy the git repo directory elsewhere as a place to do preliminary testing to see what will work, that way you can mess with whatever you want without losing untracked files or getting things into a state that you can't come back from.

这篇关于自重组开始以来,中止了旧的git rebase并失去了提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆