0/3

Lesson07

intermediate

Copy a Commit with git cherry-pick

Goal

Bring one commit from another branch onto main, and nothing else.

feature/charts is weeks from ready, but one of its commits, Fix currency rounding, fixes a bug customers are hitting on main today. Merging the branch would also bring in the unfinished charts.

Copy just the fix onto main.

Objectives

0/3
  1. main has the Fix currency rounding change. (Current objective)
  2. main does not have Add charts. (Not started)
  3. main does not have Animate charts either. (Not started)

Your task nowStep 1 of 3

main has the Fix currency rounding change.

Need help?

Reference

Picking one commit

$ git cherry-pick 7d1e4a2

[main 9b3f0c8] Fix currency rounding
 Date: Mon Oct 5 10:12:44 2026 +0200
 1 file changed, 1 insertion(+), 1 deletion(-)

Git applies the same change on top of your branch as a new commit, with the same message and author. The original stays on its branch; the copy gets a new id.

A copy, not a move

Step 1 of 2

main needs F2, the fix, but not F1 or F3.

Step 1 of 2. `main` needs F2, the fix, but not F1 or F3.

Preparing your workspace…

Repository Graph

Click a commit to inspect it

0 commits

Working Tree

Not a Git repository yet

No unstaged changes

Your working tree matches the staging area.

Staging Area

Files prepared for the next commit

No staged changes

Use git add to prepare files for your next commit.

Repository

Committed history

No commits yet

Use git commit to record staged changes.