Search code examples
gitgit-mergerevertmergetool

What commands is required to revert changes made by git mergetool?


I have made some changes to a number of conflicting files as the result of a a git pull command, using the git mergetool command, but I want to revert it back to the state before I made the changes with the mergetool.

It is basically the state where git warns that there are conflicts and lists them. What command is required for that?


Solution

  • I'm not sure if there is actually a way to "simulate" a merge and view its conflicts. However, you can certainly run the merge, view the conflicts, and immediately undo it using:

    git reset --merge
    

    For v1.7.4 and later, you can also use:

    git merge --abort