Cherry Pick

Learn to selectively apply commits to other branches.

We'll cover the following...

Cherry picking is reapplying changes of a selected commit into the current HEAD.

It’s like git revert, but the changes apply as is.

It’s often used when we want to apply a patch from a branch into the other branch, where merging or rebasing isn’t preferred.

How to use git cherry-pick

Let’s assume there’s a product with both versions 2.x and 3.x in active development. Assume that the team is actively working on 3.x and is maintaining 2.x with the latest security patch.

The developer team updates a security patch on 3.x for a component that’s shared between both versions. We want to apply the same patch to version 2.x as well. Since the ...