Use git cherry pick
To demonstrate how to use git cherry-pick let us assume we have a repository with the following branch state:
a - b - c - d Main
\
e - f - g Featuregit cherry-pick usage is straight forward and can be executed like:
git cherry-pick commitShaIn this example commitSha is a commit reference. You can find a commit reference by using git log. In this example we have constructed lets say we wanted to use commit `f` in main. First we ensure that we are working on the main branch.
git checkout mainThen we execute the cherry-pick with the following command:
git cherry-pick fOnce executed our Git history will look like:
a - b - c - d - f Main
\
e - f - g FeatureThe f commit has been successfully picked into the main branch.
Reference Links
Last updated