115

After I merged a file in Git I tried to pull the repository but error came up:

You have not concluded your merge. (MERGE_HEAD exists)

How does one conclude a merge?

Patrick McElhaney
  • 57,901
  • 40
  • 134
  • 167
Muaz Al-Jarhi
  • 1,169
  • 2
  • 8
  • 3

5 Answers5

99

Check status (git status) of your repository. Every unmerged file (after you resolve conficts by yourself) should be added (git add), and if there is no unmerged file you should git commit

MBO
  • 30,379
  • 5
  • 50
  • 52
  • 12
    But what if everything is committed (`git status` shows a clean working dir) and the above error still occurs? – Marius Soutier Mar 13 '12 at 11:02
  • 1
    @Marius Make sure you run standard `git status` and not some alias which filters out any message. In current version, when you run git status, it shows you message what should you do to "conclude merge". And if you're absolutely sure you have everything merged and you won't loose anything, then you can simply remove files in .git/MERGE*, which store what have you tried to merge, and default commit message for that merge – MBO Mar 19 '12 at 22:04
  • 1
    Thanks, that's what I eventually did, but somehow, this seems to be buggy. How can a MERGE_HEAD exist if you merged and committed everything? – Marius Soutier Mar 20 '12 at 09:23
  • 2
    Yep, I just had the same issue as Marius, had done a merge, resolved the conflicts, but nothing to commit now (somehow). Had to manually delete the MERGE* files as suggested. – Simon East Apr 30 '12 at 02:03
  • @johndpope power("tnx", 100) – knagode Feb 17 '14 at 12:50
36

Note and update:

Since Git1.7.4 (January 2011), you have git merge --abort, synonymous to "git reset --merge" when a merge is in progress.

But if you want to complete the merge, while somehow nothing remains to be added, then a crude rm -rf .git/MERGE* can be enough for Git to forget about the current merge.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • if you remove MERGE_HEAD, won't the resulting commit only have one parent so you won't have the history of the merged branch? – Jason Goemaat Dec 17 '15 at 10:21
  • @JasonGoemaat considering we try to *abort* the merge, there would not be a "resulting commit" anyway. – VonC Dec 17 '15 at 10:24
29

The easiest solution I found for this:

git commit -m "fixing merge conflicts"
git push
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
user3127648
  • 1,367
  • 12
  • 26
5

I just did:

git merge --continue

At which point vi launched to edit a merge comment. A quick :wq and the merge was done.

Emma
  • 27,428
  • 11
  • 44
  • 69
Stan
  • 51
  • 1
  • 2
2

If you encounter this error in SourceTree, go to Actions>Resolve Conflicts>Restart Merge.

SourceTree version used is 1.6.14.0