git cherry-pick command

The git cherry-pick is a powerful command that enables arbitrary Git commits to be picked by reference and appended to the current working HEAD. Cherry picking is the act of picking a commit from a branch and applying it to another. git cherry-pick can be useful for undoing changes. For example, say a commit is accidently made to the wrong branch. We can switch to the correct branch and cherry-pick the commit to where it should belong.

Syntax git cherry-pick <commit-hash> The commit-hash is a commit reference. We can find a commit reference by using git log. Only first 7 digits is enough to provide of the commit-hash.

Bash

git cherry-pick 1e5e3af