Skip to main content
Middle

Grabbing Just 1 Commit

Middle

Task

While on main, bring over only the commit C4 located at the tip of the side branch.

Requirements

  • Use selective copying of a single commit.
  • Do not move the whole history of bugFix or side.
  • You do not need to move the other branches.

Expected result

A new copy of C4 must appear at the tip of main, and the previous history of main must be preserved.

What you will learn

After completing the task, you will be able to:

  • pick a single commit from another branch;
  • apply cherry-pick without merging the whole history;
  • understand why a copied commit gets a new identifier.
Goal
localC0C1C2C3bugFixC4sideC4'HEAD main
Git trainer0 commands
terminal
localC0C1HEAD mainC2C3bugFixC4side