CS FundamentalsHardWipro · Accenture pattern

You cherry-pick commit X from branch feature onto main. Which statement is correct?

  1. A. main gets a new commit with the same changes as X but a different hash, and X itself stays only on feature
  2. B. X is moved from feature to main and removed from feature
  3. C. main gets a merge commit whose second parent is X
  4. D. main now contains commit X with the same hash, so feature counts as merged

Correct answer: A. main gets a new commit with the same changes as X but a different hash, and X itself stays only on feature

cherry-pick re-applies X's diff on a new parent, creating a new commit object (new hash). X is not an ancestor of main, so feature is not 'merged'; a later merge of feature usually applies the same change cleanly but the history shows it twice.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic