Bird
0
0

You tried to cherry-pick multiple commits but accidentally included a merge commit. What is the best way to avoid conflicts caused by this?

medium📝 Troubleshoot Q7 of 15
Git - Cherry-Pick and Advanced Merging
You tried to cherry-pick multiple commits but accidentally included a merge commit. What is the best way to avoid conflicts caused by this?
AUse <code>git merge</code> instead of cherry-pick
BSkip the merge commit with <code>git cherry-pick --skip</code>
CReset the branch and cherry-pick commits one by one
DUse <code>git cherry-pick -m 1 <merge-commit-hash></code> to specify the parent
Step-by-Step Solution
Solution:
  1. Step 1: Understand cherry-picking merge commits

    Merge commits require specifying a parent with -m to resolve which side to apply.

  2. Step 2: Use correct option to avoid conflicts

    Using git cherry-pick -m 1 <merge-commit-hash> tells git which parent to use, reducing conflicts.

  3. Final Answer:

    Use git cherry-pick -m 1 <merge-commit-hash> to specify the parent -> Option D
  4. Quick Check:

    Use -m option for merge commits [OK]
Quick Trick: Use -m option to cherry-pick merge commits correctly [OK]
Common Mistakes:
  • Skipping merge commits without understanding
  • Trying to cherry-pick merge commits without -m
  • Using merge instead of cherry-pick for specific commits

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes