CS FundamentalsVery hardGATE CS · TCS NQT Prime · Product Company SDE

What does `git cherry-pick <commit>` do?

  1. A. Merges two entire branches together
  2. B. Reverts that commit's changes
  3. C. Applies the changes introduced by that single specific commit onto the current branch, creating a new commit here, without pulling in any other commits from its original branch
  4. D. Deletes that commit from history everywhere

Correct answer: C. Applies the changes introduced by that single specific commit onto the current branch, creating a new commit here, without pulling in any other commits from its original branch

Cherry-pick takes just one commit's diff and replays it as a new commit on the current branch, which is useful for pulling a single fix across branches without merging everything else.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic