I recently finished working on this article on how to create a blog with Netlify as a CMS. While working on this article, I tried to make a merge and ended up not being able to. I had this message:

Merge branch 'master' of https://github.com/marieqg/netlify-cms-medium# Please enter a commit message to explain why this merge is necessary,# especially if it merges an updated upstream into a topic branch.## Lines starting with '#' will be ignored, and an empty message aborts# the commit.~ ~ "~/Documents/Projets/medium/netlify-cms-medium/.git/MERGE_MSG" 6L, 297CIt’s not the first time I had it, but it was sure the last time. And I was stuck there for a while again. They are a few methods to go out of this depending on the editor that you are using.

You are watching: Please enter a commit message to explain why this merge is necessary

Step 1: Understand why

Firstly, let’s try to understand why we got this message.

There a few options :

This happens when a commit was made to the branch you are working on (you try to push a commit: git push) before pulling the changes ( git pull)You updated your git clientYou never had a local branch which was ahead of the remote beforeYour git config was changed recentlyYou should have done git rebase or git pull --rebase instead of a merge


Most of the time when I get this message, it’s because I forgot to pull before I pushed and my branches get confused. Photo by Maddy Baker on Unsplash
Step 2: Finalize your merge

Then, let’s solve it to finalize our merge. The way to solve it is going to depend on our editor. So:

1. For Vi or Vim

If you are using vi or vim, to manage to get out, you’ll have to do :

Press “i” (i for insert)Write your merge messagePress “esc” (escape)Write “:wq” (write & quit)Then press enter

Personally, it’s the one I’m using (let’s not get into a developer argument on which editor to use right?), and this worked quite well for me.

2. For Pico, Nano or Emac

If you are using Nano, you’ll have to do:

CTRL + Xthen, CTRL + C

For nano, a CTRL + C might be sufficient.

See more: Latin She Flies With Her Own Wings " Introduction, She Flies With Her Own Wings

It’s as easy as this, but I always struggle with this one.