#TIL 38 - Cherry pick git merge from CLI | ProductsWay

#TIL 38 - Cherry pick git merge from CLI

Mar 9, 2023 · Dung Huynh

What

Cherry-pick a merge commit onto another branch using the -m 1 parent flag.

Why

A merge commit has two parents, so git doesn't know which diff to apply. -m 1 tells git to treat the first parent (usually main) as the baseline and replay the changes introduced by the merge.

How

git cherry-pick <merge-commit-hash> -m 1

-m 1 specifies the first parent branch as the source of changes.