How to abort git merge

Git Workflow - Merge vs. Rebase - Front-End Engineering Curriculum - Turing  School of Software and Design

Merge conflicts are as frightening to many people as accidentally formatting their hard drives. I’d like to relieve you of this fear throughout this chapter. The first thing to remember is that you can always undo a merge and return to a previous state before the conflict. You can always go back and start over.

You Cannot Break Things

If you’re coming from a different version control system, such as Subversion, You might be traumatized by Subversion: Subversion conflicts have a (deserved) reputation for being incredibly complex and nasty. One reason for this is that Git works in a completely different way than Subversion in this regard. As a result, Git can handle the majority of the work during a merge.

Furthermore, a conflict will always put you at a disadvantage. It won’t bring your entire team to a halt or make your central repository unusable. Because conflicts in Git can only happen on a developer’s local machine, not on the server, this is the case.

Use git-reset or git merge –abort to cancel a merge that had conflicts.

Reset all the changes back to the last commit.

Note: This cannot be reverted!

$ git reset --hard HEAD
OR
$ git merge --abort

Reference

Leave a Comment

Your email address will not be published. Required fields are marked *