git git-merge git-merge-conflict version-control

I ran into a merge conflict. How do I abort the merge?


I used git pull and had a merge conflict:

unmerged:   some_file.txt

You are in the middle of a conflicted merge.

How do I abandon my changes to the file and keep only the pulled changes?


  • 44

    I realise this is a super-old question, but do you want to abort the whole merge, and leave the branch you were merging unmerged, or just ignore this one file as part of a larger merge, letting all the other files merge in as normal? To me, your title implies the former, your question body wants the latter. The answers do both, without making things clear.

    – rjmunro

    Oct 7, 2013 at 11:18

  • I got similar case on commit saying that automatic merge failed; fix conflicts and then commit the result: [rejected] gh-pages -> gh-pages (non-fast-forward)

    – eQ19

    Apr 30, 2016 at 17:32

  • 4

    Gwyn, it could be useful to select an accepted answer here. The top voted one is a bit less safe than some of the more up to date solutions, so I think it would help to highlight others over it 🙂

    – Amicable

    Oct 6, 2016 at 13:11


If your git version is >= 1.6.1, you can use git reset --merge.

Also, as @Michael Johnson mentions, if your git version is >= 1.7.4, you can also use git merge --abort.

As always, make sure you have no uncommitted changes before you start a merge.

From the git merge man page

git merge --abort is equivalent to git reset --merge when MERGE_HEAD is present.

MERGE_HEAD is present when a merge is in progress.

Also, regarding uncommitted changes when starting a merge:

If you have changes you don’t want to commit before starting a merge, just git stash them before the merge and git stash pop after finishing the merge or aborting it.


  • 3

    Interesting – but the manual scares me. When exactly is it appropriate to use? When would you have to specify the optional <commit>? #GitMoment 😮

    – conny

    Nov 15, 2011 at 4:36

  • 1

    You’d typically use this when you want to redo the merge from the start. I have never had to specify the optional commit myself, so the default (no optional <commit>) is just fine.

    – Carl

    Nov 15, 2011 at 19:53

  • 54

    I wish this answer had more votes! At this point, it seems like the most relevant solution in many cases.

    Dec 7, 2011 at 22:56

  • 1

    Even with uncommited changes git was able to restore the state before the merge. Nice!

    – T3rm1

    Jun 12, 2014 at 11:45

  • 2

    Is git merge --abort just a synonym for git reset --merge? The name certainly makes more sense, but does it have the same functionality?

    Jul 22, 2014 at 18:37


git merge --abort

Abort the current conflict resolution process, and try to reconstruct
the pre-merge state.

If there were uncommitted worktree changes present when the merge
started, git merge --abort will in some cases be unable to
reconstruct these changes. It is therefore recommended to always
commit or stash your changes before running git merge.

git merge --abort is equivalent to git reset --merge when
MERGE_HEAD is present.


  • 20

    This has been available since git v1.7.4. It’s an alias for git reset –merge.

    Apr 24, 2013 at 15:41