Bird
0
0

Given the following commands run on branch feature:

medium📝 Command Output Q4 of 15
Git - Cherry-Pick and Advanced Merging
Given the following commands run on branch feature:
git cherry-pick a1b2c3 d4e5f6
What will be the result on the feature branch?
AThe command fails because multiple commits cannot be cherry-picked
BOnly commit d4e5f6 is applied, a1b2c3 is ignored
CCommits a1b2c3 and d4e5f6 are applied in order on feature branch
DA merge commit combining a1b2c3 and d4e5f6 is created
Step-by-Step Solution
Solution:
  1. Step 1: Understand cherry-pick behavior with multiple commits

    When multiple commits are listed, git applies them one by one in the given order onto the current branch.

  2. Step 2: Confirm no merge commit is created

    Cherry-pick applies commits individually; it does not create a merge commit unless specified.

  3. Final Answer:

    Commits a1b2c3 and d4e5f6 are applied in order on feature branch -> Option C
  4. Quick Check:

    Multiple cherry-picks apply commits sequentially [OK]
Quick Trick: Multiple commits cherry-picked apply one after another [OK]
Common Mistakes:
  • Thinking only last commit applies
  • Expecting a merge commit to be created
  • Believing multiple commits cannot be cherry-picked

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes