Git 進階
Amanda Crawford-Adamo
Software and Data Engineer
將特定提交的變更套用到另一個分支
挑選單一提交
git cherry-pick <commit-hash>
挑選多個提交
git cherry-pick <hash1> <hash2> ..
目的


切換到 main 分支
git checkout main
執行 cherry-pick,將 feature 分支提交 def456 的變更帶入。
git cherry-pick def456

git add <resolved-files>--continue 旗標,繼續 cherry-pick 流程git cherry-pick --continue
若要停止 cherry-pick 作業,使用 --abort 旗標
git cherry-pick --abort
Git 進階