Cherry-Picking Commits

git cherry-pick applies the changes introduced by selected commits onto the current branch. It is useful when one specific fix is needed without merging an entire branch.

Cherry-picking creates a new commit on the destination branch, so the resulting commit normally has a different hash from the original.

Apply a Specific Fix
git switch release/1.4
git cherry-pick abc1234
💡 Git applies the changes from commit abc1234 to the current branch and creates a new commit containing those changes.
Key Takeaways
  • Cherry-pick is useful for selective commit transfer.
  • The resulting commit is normally a new commit with a different hash.
  • Cherry-picking can introduce conflicts.
Knowledge Check

What does cherry-pick primarily do?