Bird
0
0

You want to cherry-pick commits c1, c2, and c3 from branch dev to main. However, c2 depends on changes in c1. What is the best approach?

hard📝 Workflow Q8 of 15
Git - Cherry-Pick and Advanced Merging
You want to cherry-pick commits c1, c2, and c3 from branch dev to main. However, c2 depends on changes in c1. What is the best approach?
ACherry-pick commits in order: c1, then c2, then c3
BCherry-pick c2 and c3 only, skipping c1
CCherry-pick all commits at once without order
DMerge the entire dev branch instead
Step-by-Step Solution
Solution:
  1. Step 1: Recognize commit dependencies

    If c2 depends on c1, applying c2 without c1 will cause errors or incomplete changes.

  2. Step 2: Apply commits in correct order

    Cherry-pick commits sequentially in dependency order: c1, then c2, then c3.

  3. Final Answer:

    Cherry-pick commits in order: c1, then c2, then c3 -> Option A
  4. Quick Check:

    Apply dependent commits in order [OK]
Quick Trick: Cherry-pick dependent commits in sequence [OK]
Common Mistakes:
  • Skipping dependent commits
  • Cherry-picking out of order
  • Merging entire branch when only some commits needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes