Interview Prep/Git & GitHub/Merge and Rebase Problems

`error: commit 8f3a2c1 is a merge but no -m option was given.` on `git cherry-pick`.

IntermediateTroubleshootingMerge and Rebase Problems
Answer

Likely causes → The commit has two parents and Git does not know which diff to apply.

Diagnose → git show --no-patch --format='%h parents: %p' 8f3a2c1.

Fix → git cherry-pick -m 1 8f3a2c1 applies the changes relative to the first parent (the branch that was merged into). Or cherry-pick the individual commits of the merged branch.

Prevent → Use squash merges so every PR is a single normal commit.

All Git & GitHub questions Roadmap: Git & GitHub

More on Merge and Rebase Problems