Ahmad Qasim
Ahmad Qasim

Reputation: 474

How to undo the git --abort

Is it possible to undo the git abort. Scenario is that I was merging two branches when run command git merge its shows an error message you have uncommitted changes, therefor I run git commit now message appears "fatal error there is a merge conflict between, abort the operations to resolve the issue", so I run the command git merge --abort. After this i lost my local code changes too. Is there any solution to undo abort or get my local code back.

Upvotes: 3

Views: 7237

Answers (4)

5anjek
5anjek

Reputation: 26

In addition to other answers, if you ran --abort using some git client, check your git stash with git stash list, chances are the client stashed all changes before resetting your working tree.

Upvotes: 0

Ganesa Vijayakumar
Ganesa Vijayakumar

Reputation: 2602

The straight answer is NO if you looking around git since there won't record for your uncommitted and deleted local changes but you can check your IDE and check that is there anything you can get from local history.

Upvotes: 3

Romain Valeri
Romain Valeri

Reputation: 22057

No, unfortunately if you didn't commit your changes in between the moment the failed merge started and the --abort, they haven't been saved anywhere.

You'll have to not only redo your merge but also these changes (though it might be a good idea to do so separately).

Upvotes: 4

padawin
padawin

Reputation: 4476

Undoing the abort is basically redoing the merge.

So, rerun the git merge to restart, solve the conflicts using git mergetool and finally run git commit to finalise the merge.

If you don't know how to use git mergetool, here is a guide about it: https://gist.github.com/karenyyng/f19ff75c60f18b4b8149

Upvotes: 4

Related Questions