简体   繁体   中英

Recover after git rebase --abort

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

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.

如果您在rebase期间没有提交这些修改,那么遗憾的是它们将不可避免地丢失。

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

you can checkout to the commit you want after doing a reflog.

git checkout 57d731c 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM