Abort a Git Merge

Salman Kazmi picture Salman Kazmi · May 18, 2017 · Viewed 223.4k times · Source

I am working on a project using Git as the VCS. I got a branch xyz cut from the mainline branch of master. After working for a while, I committed my code and took a pull of the branch mainline.

The pull was fine. I then merged the code with master. After the merge, there were problems in certain files. I have not committed the code after merging. Can someone please guide as to how I can abort this merge and bring my branch where I am working currently to the state where it was before I merged it?

Answer

Timothy Truckle picture Timothy Truckle · May 18, 2017

as long as you did not commit you can type

git merge --abort

just as the command line suggested.