Skip to main content
Module 6 · Lesson 4 of 426/34 in the course~18 min
Module lessons (4/4)

Targeted commit porting with cherry-pick & --onto

Lesson preview5 hands-on exercises readyGit & Modern Collaboration · Module 6 — Rewriting Local History Cleanly

Backport single bugfix commits selectively across release branches cleanly.

What you'll learn in this lesson

  • Backport a single critical bugfix cleanly onto a separate release branch using git cherry-pick <sha>.
  • Compare surgical cherry-pick against full-branch git merge, git rebase, and three-arg git rebase --onto.
  • Tag a hotfix release cleanly while avoiding unreleased commits from main.

Overview

Imagine main has already raced ahead with experimental v3 work (compute gross total), while production running on an older release/v2 track urgently needs one single VAT rate bugfix commit (main~1, updating tax to 22%)—without dragging unfinished v3 changes along!

git cherry-pick <sha> reads the exact diff patch introduced by commit <sha> and applies it directly as a brand-new commit on your current HEAD:

Sections covered in this lesson

  1. 1Surgical Backporting Across Release Lines
  2. 2Visualize Branch Slices Live
Pro Lesson · Module 6 — Rewriting Local History Cleanly

Unlock "Targeted commit porting with cherry-pick & --onto" and the full Git & Modern Collaboration curriculum

Backport single bugfix commits selectively across release branches cleanly.

Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in Git & Modern Collaboration plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.