Bird
0
0

You want to cherry-pick a commit that is a merge commit with hash def456. Which command correctly cherry-picks it?

hard📝 Application Q8 of 15
Git - Cherry-Pick and Advanced Merging
You want to cherry-pick a commit that is a merge commit with hash def456. Which command correctly cherry-picks it?
Agit cherry-pick -a def456
Bgit cherry-pick -m 1 def456
Cgit cherry-pick --merge def456
Dgit cherry-pick def456
Step-by-Step Solution
Solution:
  1. Step 1: Understand cherry-picking merge commits

    For merge commits, you must specify the parent with -m <parent-number>.
  2. Step 2: Identify correct syntax

    git cherry-pick -m 1 def456 applies the first parent changes from the merge commit.
  3. Final Answer:

    git cherry-pick -m 1 def456 -> Option B
  4. Quick Check:

    Cherry-pick merge commit = use -m with parent number [OK]
Quick Trick: Use '-m 1' to cherry-pick merge commits correctly [OK]
Common Mistakes:
  • Omitting -m flag for merge commits
  • Using invalid flags like --merge or -a
  • Confusing merge commit cherry-pick with normal commits

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes