"Is a Merge But No -m Option Was Given" — What This Git Error Means and How to Fix It

If you've ever run a git commit or git merge and been met with the message "is a merge but no -m option was given", you're not alone. It's one of those Git errors that looks cryptic at first glance but actually points to something very specific — and very fixable once you understand what Git is trying to tell you.

What This Error Actually Means

Git uses a special merge commit format whenever two branches are being joined together. Unlike a regular commit, a merge commit has two parent commits — one from each branch being merged. Git requires a commit message to describe that merge, and it expects you to provide one explicitly using the -m flag.

When you see:

Git is saying: "I can see this is a merge commit in progress, but you didn't give me a message to attach to it."

This most commonly surfaces in a few specific situations:

  • You're in the middle of a merge (after a conflict resolution) and you run git commit without a message
  • You're using a script or alias that calls git commit without passing -m
  • You've customized your Git workflow and something is calling commit in a way that bypasses the usual message prompt
  • Your MERGE_HEAD file exists in the .git folder, signaling an in-progress merge that Git is trying to complete

Why Git Enforces This for Merges Specifically

For a standard commit, Git will open your default editor (usually Vim, Nano, or whatever you've configured) to collect a message interactively. But in certain non-interactive environments — like scripts, CI/CD pipelines, or terminal sessions where the editor can't open — Git won't fall back gracefully. Instead, it errors out.

The -m flag lets you pass the commit message inline, bypassing the editor entirely: