Search code examples
gitversion-controlrebase

Undoing Git rebase --abort


I had local changes in my repository. before push , i fetch from remote and did rebasing it shows some conflicts and i fixed it.

and then i tried to push my changes , before commit it shows still need merge so i did rebase --abort without commiting my changes. after that my local changes was gone. i tried git reflog i dont find mine since i didnt commit.

I need my local changes how do i get it back? how rebase --abort delete my changes?

I did rebase --continue once i fix conflict. since it says need update. then only i gave rebase --abort


Solution

  • From your question along with what you commented above, it looks like you started a rebase, made some progress along the way, but did not complete it. Instead, you typed git rebase --abort. This effectively rolls back the entire rebase to the point where you were before you started the rebase. There is no harm in aborting a rebase, save any work you already did resolving merge conflicts.

    In any case, you should be able to just start the rebase origin/<branch> again. This time around, just resolve the conflicts as each commit is applied by adding each conflicted file to the stage, and using git rebase --continue. When all commits have been replayed, your rebased branch should be ready, with an empty working directory.