Reading List

The Selfish Gene
The Psychopath Test: A Journey Through the Madness Industry
Bad Science
The Feynman Lectures on Physics
The Theory of Everything: The Origin and Fate of the Universe


ifknot's favorite books »

Saturday 25 June 2016

You have not concluded your merge (MERGE_HEAD exists) - ARRRGH! FFS Git! (╯°□°)╯︵ ┻━┻)


photo credit: Walking dead via photopin (license)

You have not concluded your merge (MERGE_HEAD exists)


Rant:

FFS Linus! Why did you have to make Git so complicated? 

As others have pointed out. You need a bunch of arcane, inconsistent, constantly changing commands to do the most routine of tasks and the behaviour is counter-intuitive - why make vim the default editor?! Why make me learn all this stuff just to get things done?! *sigh* 


No fucks given Linus:

The readme file of the source code elaborates further:


The name "git" was given by Linus Torvalds when he wrote the very
first version. He described the tool as "the stupid content tracker"
and the name as (depending on your mood):

 - random three-letter combination that is pronounceable, and not
   actually used by any common UNIX command.  The fact that it is a
   mispronunciation of "get" may or may not be relevant.
 - stupid. contemptible and despicable. simple. Take your pick from the
   dictionary of slang.
 - "global information tracker": you're in a good mood, and it actually
   works for you. Angels sing, and a light suddenly fills the room.
 - "goddamn idiotic truckload of sh*t": when it breaks


The problem:

Any way when you get this error: (and you will)
You have not concluded your merge (MERGE_HEAD exists)
There are numerous scenarios in which this message could occur and the resolution will
depend on how you got there. Consequently...
 git status
Is a good starting point.


Solution 1.

If you've already merged the contents to your satisfaction and are still getting this message, it could be as simple as doing git add file git commit But again, it really depends on the situation.


Solution 2.

For me the problem wa s previous pull failed to merge automatically and went into conflict state and the conflict wasn't resolved properly before the next pull.

  • Change the default editor before you do anything: (I mean, vim as default, who does that!?)
    • git config --global core.editor "nano"
    • Unwind your changes
    • git merge --abort 
    • Resolve the conflict, add, commit as usual
    • Then you can merge
    • git pull


    Solution3. Go Nuclear!

    If you are sure that you already resolved all merge conflicts:
    (This will remove MERGE_HEAD and the resulting commit will only have one parent and you will lose the history of the merged branch - which is probably what you want.)

    rm -rf .git/MERGE*

    2 comments:

    1. I would suggest to read article on below mentioned link, it was helpful to me.
      you have not concluded your merge (merge_head exists) + "askforprogram"

      ReplyDelete
      Replies
      1. Thanks Samir good link - git can be a bit frustrating at times and it helps to vent :)

        Delete