xxxxxxxxxx
# from the branch you want to apply changes
# it will bring all commit changes but also stage them
git cherry-pick <commit-hash>
# it will bring all commit changes but leave them unstaged
git cherry-pick -n <commit-hash> #OR
git cherry-pick --no-commit <commit-hash>
xxxxxxxxxx
#Checkout the branch you want to apply the commit to.
git checkout master
#Cherry pick using the commit hash.
git cherry-pick <commit-hash>
#If cherry picking from a public branch use "-x" to add a standardized commit message.
git cherry-pick -x <commit-hash>
xxxxxxxxxx
The command git cherry-pick is normally used to introduce particular commits from one branch within a repository onto a different branch. Another common use is to forward- or back-port commits from a maintenance branch to a development branch. This is in contrast with other ways such as merge and rebase which normally apply many commits onto another branch.
Consider:
git cherry-pick <commit-hash>
xxxxxxxxxx
git cherry-pick -x A^..B # without the ^, commit A will be ignored
# -x is recommended for browsable links in github or gitlab
useful to see where a commit was picked from.