error: commit ... is a merge but no -m option was given. means you asked
git cherry-pick to copy a merge commit. A merge has two parents, so Git needs
to know which side to compare against. Add -m 1 to take the changes the
merge brought into its first parent, the branch it was merged into.
The fix as run: git cherry-pick -m 1 develop. If what you want is the work on
the merged branch rather than the merge itself, cherry-picking the branch's own commits
is the other route.
The error
> git log --oneline --graph develop
* bfbfdbd Merge branch 'feature/search' into develop
|\
| * 35dd436 add search
|/
* de826a2 base
> git cherry-pick develop
error: commit bfbfdbd7d31cfad3cffedd6a7431a93c8e9f8bd8 is a merge but no -m option was given.
fatal: cherry-pick failed
exit=128
Why it happens
develop pointed at bfbfdbd, a merge made with
git merge --no-ff feature/search. Its parents are de826a2 (parent
1, where develop was) and 35dd436 (parent 2, the feature
branch), as the graph shows. Without
-m, Git refused and exited with 128, and the later log shows no commit
was added by that attempt.
The fix
> git cherry-pick -m 1 develop
[release 98188d9] Merge branch 'feature/search' into develop
Date: Fri Nov 6 13:23:04 2026 +0530
1 file changed, 1 insertion(+)
create mode 100644 search.txt
exit=0
> git log --oneline -2
98188d9 Merge branch 'feature/search' into develop
de826a2 base
> git ls-files
base.txt
search.txt
With -m 1 the cherry-pick compared the merge with its first parent, so the new
commit 98188d9 on release added search.txt, the file
the feature branch brought in. The result is an ordinary commit with one parent, as
git log --oneline -2 shows; it kept the merge's message. Check the parent
order with git log --oneline --graph before choosing the number: in this
graph parent 1 is the line straight down from the merge.
The trailing spaces on two graph lines were trimmed; nothing else in the first block changed.
Note what the new commit is not: it is not a merge, and release does not
record that feature/search was merged into it. The log shows one new commit
on top of base and no second parent. The new id, 98188d9, differs
from the merge's bfbfdbd, so Git treats them as two commits; decide whether
release should get a copy or a real merge of develop before you
copy the merge across.
How it was reproduced
Git for Windows 2.45.2.windows.1 in Windows PowerShell 5.1: a new repository with a
base commit on main, a branch feature/search adding
search.txt, a branch develop from main with
git merge -q --no-ff feature/search, and a branch release from
main where git cherry-pick develop ran. Repository config only.
Frequently asked
- How do I cherry-pick a merge commit in git?
- Add -m with the parent number. git cherry-pick -m 1 with the merge commit takes the changes the merge brought into its first parent, the branch that was merged into.
- What does -m 1 mean in git cherry-pick?
- It tells cherry-pick to compare the merge with its first parent. In this test that copied the files the merged feature branch had added onto the current branch as one ordinary commit.
- Why does git say commit is a merge but no -m option was given?
- The commit you named has two parents, and git cherry-pick does not choose one for you. In this test Git refused and exited with 128, and the later log showed no commit was added until -m was given.
For cherry-pick in normal use, see rebase, cherry-pick and stash. More decoded errors in the Fixes category.