Mohideen bin Mohammed
Mohideen bin Mohammed

Reputation: 20137

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

Upvotes: 4

Views: 6925

Answers (3)

henrique_ms
henrique_ms

Reputation: 321

Try

Resolve conflicts

1.

git add
git rebase --continue

Upvotes: 0

valegians
valegians

Reputation: 940

If you are using IntelliJ IDEA, you can right-click the root of your project go to Local History, and then Show History. You can now see all recent local changes and revert any files you want.

Upvotes: 7

Tim Biegeleisen
Tim Biegeleisen

Reputation: 521259

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.

Upvotes: 1

Related Questions