Skip to main content
Middle

Introduction to Cherry-pick

Middle

Task

While on main, copy the commits C3, C4 and C7 from other lines of history onto it one after another.

Requirements

  • Use cherry-pick.
  • Keep the order: first C3, then C4, then C7.
  • Do not move the other branches.

Expected result

A linear chain of three new copies of the chosen commits must appear at the tip of main. HEAD must stay on main.

What you will learn

After completing the task, you will be able to:

  • move individual commits between branches;
  • apply several cherry-picks in a given order;
  • tell copying commits apart from merging a whole branch.
Goal
localC0C1C2C3bugFixC3'C4C4'C5sideC6C7anotherC7'HEAD main
Git trainer0 commands
terminal
localC0C1HEAD mainC2C3bugFixC4C5sideC6C7another