Cherry Pick
Explore how to use Git cherry pick to reapply specific commits from one branch to another within your projects. Understand practical use cases like applying security patches across multiple versions and learn how to resolve conflicts that may arise during cherry picking for cleaner and more precise version control.
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 ...