Sam
Sam

Reputation: 1643

GIT cherry-pick giving error

I am trying to cherry-pick one of the commit using the sha to my branch but its giving error.

Say I am on branch x, then I am running the command git cherry-pick as560aad0138.... in my terminal.

The error I got is like this;

error: Commit as560aad0138.... is a merge but no -m option was given.
fatal: cherry-pick failed

Upvotes: 0

Views: 1464

Answers (1)

chelmertz
chelmertz

Reputation: 20601

The answer is right there, in the error message.

From man git cherry-pick:

[...] -m parent-number, --mainline parent-number

Usually you cannot cherry-pick a merge because you do not know which side of the merge should be considered the mainline. This option specifies the parent number (starting from 1) of the mainline and allows cherry-pick to replay the change relative to the specified parent. [...]

Upvotes: 2

Related Questions