Recover after git rebase --abort

大憨熊 提交于 2019-12-24 00:29:52

问题


I started a git rebase in my repository a day ago and never finished it. I forgot about and did a lot of modifications while I was still in the rebase. Today I accidentally did a git rebase --abort without putting those modifications in a commit. Now it looks like all my modifications are gone. Is there any way to recover them?

My git reflog looks like this:

57d731c HEAD@{0}: rebase: aborting
d2d3738 HEAD@{1}: rebase -i (start): checkout david
57d731c HEAD@{2}: commit: My commit message

回答1:


You can only recover if you have added the content even if you did not commit. But if you did not even added the changes to the staging are you cannot recover those changes unless you use IDE and the IDE has local history of your changes.

git start to track file once they are in the stage area and not while they are untracked.

The local history exists in all the majors IDEs.




回答2:


If you didn't commit those modifications during the rebase, they unfortunately will be irrevocably lost.




回答3:


It's better to use git stash before git rebase. git stash pop can easily take you where you were.



来源:https://stackoverflow.com/questions/36849850/recover-after-git-rebase-abort

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!