Bird
0
0

Why might cherry-picking multiple commits cause duplicate commits in history, and how can this be avoided?

hard📝 Conceptual Q10 of 15
Git - Cherry-Pick and Advanced Merging
Why might cherry-picking multiple commits cause duplicate commits in history, and how can this be avoided?
ABecause cherry-pick deletes original commits; avoid by using reset
BBecause cherry-pick rewrites commit hashes; avoid by rebasing instead
CBecause cherry-pick creates new commits; avoid by merging branches instead
DBecause cherry-pick merges branches; avoid by using revert
Step-by-Step Solution
Solution:
  1. Step 1: Understand cherry-pick commit creation

    Cherry-pick applies commits by creating new commits with new hashes, duplicating changes in history.

  2. Step 2: Avoid duplication by merging

    Merging branches preserves commit history without duplication, avoiding duplicate commits.

  3. Final Answer:

    Because cherry-pick creates new commits; avoid by merging branches instead -> Option C
  4. Quick Check:

    Cherry-pick duplicates commits; merge to avoid [OK]
Quick Trick: Cherry-pick duplicates commits; merge to keep history clean [OK]
Common Mistakes:
  • Confusing cherry-pick with rebase
  • Thinking cherry-pick deletes commits
  • Believing cherry-pick merges branches

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes