What is cherry pick in Git? We have added a new intermediate Git tutorial video to our popular Learning Git with GitKraken educational series, covering the cherry pick command and related benefits.
View the latest addition to our Learn Git library—Learning Git: How to Cherry Pick—to discover more about how to use the cherry pick command, for which situations it can be used most effectively in your workflow, and tips for avoiding duplicate commits.
Get the latest version of the GitKraken Git GUI:
How does cherry pick work in GitKraken?
In this cherry pick example, let’s say you accidentally commit your changes to the branch you currently have checked out—feature-A—when you were supposed to commit them to a different branch—feature-B.
To cherry pick in GitKraken, you’re going to double-click on the intended branch—feature-B—and then right-click on the commit containing your changes from the feature-A branch. This will open a context menu; from here you can select Cherry pick commit.
Next, you will decide whether you wish to immediately commit the changes as they are, to the new branch—feature-B—or you can continue working on them in your working directory as part of the WIP node.
Psst: don’t forget to go back and clean up your repo history. Checkout the feature-A branch and do a hard reset on the parent commit. This will remove the duplicate commit from the feature-A branch.
Stay on the cutting edge of software development by getting innovative tips, trends and stories delivered to your inbox every month!