GIT Fatal You Have not Concluded Your Merge MERGE_HEAD Exists
fatal: You have not concluded your merge. (MERGE_HEAD exists)
I got this message because when I performed a “git pull”. I searched for a solution for this problem on the Internet and it wasn’t until I found this post that I was able to resolve this issue. The problem was that I:
- Performed a “git pull” and the automatic merge failed and I ended up with merge conflicts
- I resolved the merge conflicts and added the resolved files back using “git add”
- Performed a new “git pull” and got the “Fatal You Have not Concluded Your Merge MERGE_HEAD Exists” error
Apparently step 3 overrides MERGE_HEAD, starting a new merge with a dirty index. According to the post this is a common mistake made by programmers that are used to version control systems where the user follows an “update” and “commit” work flow.
So how do we resolve this issue? What worked for me was to follow the instructions for how to “Undo a merge or pull inside a dirty work tree” found here.
- I used “git reset –merge ORIG_HEAD”
- I resolved the merge conflicts again and added the resolved files back using “git add”
- I was then finally able to “push” my changes!
According to the documentation if you run a “git reset –hard ORIG_HEAD” it will let you go back to where you were before you were trying to commit your changes, however you will lose local changes. Most likely not what you want to do. Using “git reset –merge” will let you keep your local changes. You will however have to re-resolve your conflicting merge files.
Some additional information on this topic can be found here.
Comments
13 Comments
FYI, for anyone else who stumbles across this page like I did (by searching that error message): All I needed to do was commit.
That’s interesting and I’m glad it worked for you. In my case it wouldn’t even let me commit.
It wouldn’t let me commit either until I did a
git add
on the file I had to manually merge.Yeah that makes sense. Unfortunately for me even after that it wouldn’t let me commit. I like GIT but there are a few gotchas for sure.
Alakazaam-information found, problem solevd, thanks!
I had a conflict with several files, which I fixed. Then I got this warning and I did as evan said for each file:
git commit -a
then I tried to pull from the other directory again and found everything was “up-to-date”
Hey.
Thanks a lot for the article, but I think you have to add another step between 2 and 3: git commit -m “Comment”
Because I was following your steps, and only after applying git commit I became able to push my changes
Hi, thanks a lot for that article which made me understand my problem.
So what about this :
git pull
// solving conflicts, the result is no change required, so I can’t commit
git pull
// fatal: You have not concluded your merge (MERGE_HEAD exists).
To fix this I just added an empty line (or something like that) in the both files that were in conflicts, but I suppose there is a better solution ?
After resolving the conflict (just using theirs) and then trying everything I could think of. I finally got a message when trying to commit that said “not all files are selected for merge”. So I selected what looked like all the files that were new or changed and selected add to index. That makes no sense to me thanks to the commenter that said to “add”.
I have also met this issue.
I have entered a git commit, and receive this:
git commit -m “why this?”
# On branch master
nothing to commit (working directory clean)
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:
git commit –allow-empty
Otherwise, please use ‘git reset’
So I type git reset, and it works well, I can do git pull after this.
Like in some other comments I just did add, commit and it worked beautifully. Thanks!
I’m kinda new to git with Visual Studio and was trying to sync before adding
and committing local changes.
I already resolved merge conflicts. So I just needed to add, commit, then sync.
Thank you!
i just resolved issue. how i did?
in Intellij- in my own branch- i commited files which i recently pulled from master branch. after commit is successfull i pulled again from master branch. booommm it works
Leave a Comment