Bird
0
0

Given the following commands executed on branch main:

medium📝 Command Output Q4 of 15
Git - Cherry-Pick and Advanced Merging
Given the following commands executed on branch main:
git cherry-pick abc123

What will happen if commit abc123 is a bug fix from feature branch?
AThe <code>feature</code> branch will be deleted
BThe bug fix commit will be applied to <code>main</code> as a new commit
CThe entire <code>feature</code> branch will be merged into <code>main</code>
DThe commit <code>abc123</code> will be ignored
Step-by-Step Solution
Solution:
  1. Step 1: Understand cherry-pick effect on current branch

    Cherry-pick applies the specified commit as a new commit on the current branch without merging the whole branch.
  2. Step 2: Eliminate other outcomes

    Cherry-pick does not merge branches, delete branches, or ignore commits.
  3. Final Answer:

    The bug fix commit will be applied to main as a new commit -> Option B
  4. Quick Check:

    Cherry-pick applies commit to current branch [OK]
Quick Trick: Cherry-pick adds commit to current branch only [OK]
Common Mistakes:
  • Thinking cherry-pick merges whole branches
  • Assuming cherry-pick deletes branches
  • Believing cherry-pick ignores commits

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes