36 / 57 · 17 Git & Version Control · Bisect and Cherry-Pick← prev⊞ allnext →☰ Read as one page
5.6Cherry-Pick: Targeted Commit Application
Cherry-pick applies a specific commit from one branch to another without merging the entire branch. It creates a new commit with the same changes but a different hash.
# A bug fix was committed to develop, but you need it on the release branch now
git checkout release/2.4
git cherry-pick abc123f
# Cherry-pick multiple commits
git cherry-pick abc123f def456a ghi789b
# Cherry-pick a range of commits
git cherry-pick abc123f..ghi789b
# If there is a conflict, resolve it and continue
git add .
git cherry-pick --continue
# Or abort the cherry-pick
git cherry-pick --abort