git cherry-pick 将一个特定提交从一个分支应用到另一个分支——仅复制该提交的更改,而不合并整个分支。它对于选择性地应用特定更改(如回溯一个修复)很有用。
Cherry-pick 如何工作
# apply a specific commit from another branch onto the current branch
git cherry-pick <commit-hash>
# → creates a NEW commit on the current branch with that commit's changes
# (a copy — new hash, same changes)
git cherry-pick <commit1> <commit2> # multiple commits
git cherry-pick A..B
