Cherry-Pick

Sometimes you want one commit from another branch, not all of it. A bug fix buried under a week of unfinished work, say.

Cherry-pick copies a single commit onto your current branch. Like rebase it makes a copy with a new id, and like rebase it leaves the original exactly where it was.

Exercises

  1. Exercise 1. feature has a fix as its first commit past the split. Copy just that commit onto main, leaving feature untouched.
  2. Exercise 2. A branch name is shorthand for the commit at its tip. Cherry-pick feature by name to copy its latest commit onto main.