eduKatePunggol · Practical learning guide
Find your next learning step
Choose a route through Git Cherry-Pick to understand the mechanism, check a worked example and plan the next practice.
Full chapter index · Practice and parent questions · How Studying Works
If your child has fixed a school coding project on one branch and needs that specific fix on another, Git cherry-pick can help them move the change deliberately. Learning Git cherry-pick in Punggol tuition, or in a proposed home coding exercise, starts with checking what the chosen commit contains and whether the receiving branch has the context the fix needs.
Git cherry-pick applies the change introduced by a selected commit to the current branch, normally recording a new commit there. For example, if a source commit changes a heading from “Pratice Log” to “Practice Log”, cherry-picking that commit can apply the same correction on a compatible target branch. It does not mean that the target branch receives every other change on the source branch.
To master the git cherry-pick command, a learner needs to distinguish the chosen change from the history around it. Then they must inspect dependencies, resolve any conflict according to the intended project behaviour and check the resulting files. For a Punggol family reviewing an evening coding task, the useful question is “Which correction are you bringing across, and how will you show that it works here?”
This lesson uses disposable local practice repositories and invented project files. It does not require a public repository or a connected account. The exercises are proposed learning activities, not claims about advertised classes or actual pupils. Follow the school’s rules for submitted work and collaboration, and use the official Git cherry-pick manual for the command options available in the installed Git version.
Choose a chapter
Select and prepare · 1–5
Inspect and recover · 6–11
Check deeper cases · 12–15
Complete the labs · 16–18
A branch can contain more than the desired fix
Imagine an invented project with a stable branch and an experimental branch. The experimental branch contains a corrected heading, a redesigned colour scheme and an unfinished search feature. The stable branch needs only the heading correction. Bringing across all three changes would answer a broader question than the task asks.
A commit is a recorded step in the project’s history. Before selecting one, inspect its message and its actual diff. A message saying “Fix heading” is helpful, but it is not proof that only the heading changed. The diff could also include unrelated edits made before the commit was recorded. A learner should verify the change itself rather than rely on its label.
In a local practice repository, git show <commit> displays the selected commit and its patch. The placeholder represents an actual commit identifier or another revision expression resolved in that repository. Do not copy a made-up identifier from a tutorial and expect it to exist in your project. Obtain the candidate from your own inspected history.
Name the intended result before applying the patch
Write one sentence: “On the target branch, the project heading should read Practice Log while the target’s other features remain as intended.” This sentence makes the learning job testable. It also reveals whether the chosen commit is suitable. If the commit changes several unrelated files, the learner should inspect those changes and choose an appropriate method rather than blindly treating the commit as an isolated correction.
Cherry-pick is convenient when a recorded change is the unit you want. It is not automatically the best operation for every transfer. A task that needs an entire line of development may call for a merge. A task that needs a new, deliberately reworked solution may call for making that solution directly on the target branch. Understanding the job helps avoid choosing a command just because its name is familiar.
Practice: inspect a commit with an attractive message
A commit labelled “Correct one spelling error” changes a heading, removes a test and alters a configuration file. Should the learner assume that cherry-picking it transfers only the spelling correction? No. Inspect and account for the whole change introduced by the commit. The message may be incomplete, and the receiving project should not acquire unrelated alterations without a reason.
The destination is the current branch
The command acts on the branch currently checked out. That makes destination checking essential. In a disposable learning repository, inspect the current branch and repository status before applying a selected change. A successful command on the wrong branch can still be the wrong action for the project.
Use git status to see the working tree and any operation already in progress. Uncommitted work can complicate the transfer or prevent it. The practice exercises should begin from a clean, understood state, with a recorded starting point. This gives the learner a reliable basis for comparing what changed.
Avoid treating status output as background text. If Git reports a conflict or an unfinished operation, identify what that state means before issuing another command. The project may already be partway through a cherry-pick, merge or rebase. Starting a new action without reading the current state can make a straightforward exercise confusing.
A branch label and a commit identity answer different questions
A branch label identifies a movable position in history. A particular commit identifier identifies a recorded commit. If the learner selects the tip of a branch, verify that it is still the commit they intended. Someone else may have added another commit, or the learner may have made additional changes since first reading the history.
In a small local exercise, record the selected commit before switching to the target branch. Then use that exact identity for the intended transfer. This does not replace an immediate inspection of the destination. It separates “which source change?” from “which receiving branch?” so both decisions remain visible.
Practice: find the destination mistake
The selected patch is correct, but the learner applies it while still on a third branch used for another exercise. The files there change as expected. Has the stable branch received the fix? No. The action affected the current destination. Check the branch first, inspect the resulting history and carry out the intended transfer deliberately. Do not assume that a correct patch automatically chooses the correct place to land.
CHAPTER 3 OF 21 · Select and prepare
3. Understand why the receiving commit is usually new
A repeated change can have a different place in history
In the ordinary cherry-pick workflow, Git creates a new commit on the target branch containing the applied change. Its parent is the target’s previous tip rather than the source commit’s original parent. That difference in historical context is one reason a repeated change should not be described simply as “moving the same commit”.
The source commit remains part of its original history. Cherry-pick can replay its change elsewhere. If the original branch is later merged, the project’s history may contain different commits representing similar changes. A learner should understand this possibility before using cherry-pick repeatedly as a substitute for planning how branches will be integrated.
Content verification is still necessary
A newly recorded target commit is evidence that an operation completed. It is not proof that the resulting project behaves correctly. The patch may apply cleanly to a different context while relying on a helper function or configuration that the target lacks. The files can also contain a logically incorrect resolution that is syntactically acceptable.
Inspect the target diff and run the project checks appropriate to the change. For a heading correction, confirm the intended text in the relevant file and, when applicable, in the rendered output. For a function fix, run a test that exercises the corrected behaviour. Merely counting a new commit or accepting a success message does not complete the reader’s job.
Practice: distinguish clean application from working behaviour
A source change adds a call to normaliseTitle, which was introduced in an earlier source commit. The target does not contain that function. The selected patch applies without a textual conflict. Does that establish that the target works? No. The patch’s dependency is absent. Inspect the required context, decide which changes belong on the target and test the resulting behaviour. A clean patch is a statement about application, not every assumption made by the code.
CHAPTER 4 OF 21 · Select and prepare
4. Treat a conflict as a question about the intended result
A conflict is not an instruction to choose a favourite side
Suppose the source corrects a heading, while the target independently rewrites that same heading for a different project purpose. Git may be unable to combine the overlapping edits automatically. A conflict asks the learner to decide what the target should contain given both the desired correction and its current context.
Read the conflicting region and the surrounding file. Identify the source change’s purpose and the target’s requirement. A correct resolution may use one side, the other side or an edited combination. Selecting one side mechanically can lose either the correction or the target’s intended behaviour.
Continuing requires a resolved, checked result
The usual conflict workflow is to edit the files into their intended state, stage the resolved files and continue the operation with git cherry-pick --continue. Before staging, inspect the diff and remove conflict markers as part of producing a valid final file. Removing markers alone is insufficient; the remaining content must express the intended result.
If the operation should be cancelled, git cherry-pick --abort returns to the pre-sequence state as described by Git’s manual. --quit has a different job: it forgets the sequencer operation rather than promising the same restoration. Do not treat commands with different recovery purposes as interchangeable.
Practice: resolve the meaning, then the text
The source says “Practice Log”, while the target says “Weekly Practice Record”. The task is to keep the target’s weekly-record purpose while repairing a spelling error elsewhere in the selected change. Choosing the source heading merely because it arrived with the fix may undo a deliberate target edit. Explain the intended final heading, account for the other patch changes and check the result on the receiving branch.
The next part of this lesson develops a fully reproducible local lab, dependency ordering, empty commits, redundant changes, no-commit mode, conflict recovery, independent verification and parent questions that assess understanding without completing the learner’s project for them.
CHAPTER 5 OF 21 · Select and prepare
5. Build a disposable local lab before touching important work
A small repository makes the history visible
Use a temporary folder containing invented files. Initialise a repository, configure an identity used only for the exercise if needed, create a stable branch and record one simple starting file. Then create an experiment branch, correct one line and commit that correction. Add a separate later commit that creates an unrelated file.
The exercise should produce a history with a clear question: can the learner apply the correction commit to stable without also bringing across the later unrelated feature? Record the selected correction’s identifier from the actual local history. Do not reuse an identifier printed in this article, because commit identities are generated from repository-specific data.
Before applying anything, run the project’s equivalent of git show <selected-commit>. Verify the changed path, the removed line and the added line. Switch to stable and check git status. The working tree should be clean and the current branch should be the intended destination. These checks are part of the learning outcome, not ceremony added around the command.
Observe the result from several angles
After cherry-picking the selected correction, inspect the file content, the latest commit and the diff between the starting stable commit and the new stable tip. Confirm that the unrelated file from the later experiment commit does not exist on stable. This gives four pieces of evidence: the intended content changed, a new target commit was recorded, the target’s parent relationship is visible and the unrelated work stayed behind.
The new commit normally has a different identity from the source commit because its parent is different. Its patch can represent the same correction while occupying a different position in history. The exercise should make this distinction visible rather than treating a commit identifier as a portable label for a file change.
Practice: write a pre-action checklist
Before the command, the learner should be able to state the destination branch, the selected commit, the paths it changes, the reason the change belongs on the destination, the check that will demonstrate success and the starting commit to which the lab can return. A checklist is useful when it supports understanding; it should not replace reading the actual repository state.
CHAPTER 6 OF 21 · Inspect and recover
6. Map dependencies before choosing several commits
A later fix may rely on an earlier introduction
Suppose commit A adds a normaliseTitle function, and commit B changes a display to call that function. Cherry-picking B alone may apply cleanly because the target file contains the same display line, yet the resulting program fails because normaliseTitle is absent. The textual patch does not carry every assumption made by the author.
Inspect the changed code and its referenced names, files, configuration, generated assets and tests. Use repository history to locate when those dependencies were introduced. The appropriate action may be to apply A before B, redesign B for the target, or choose a broader integration method. The decision depends on which behaviour the target should own.
Order can affect the result
When applying several dependent commits, chronological order is often meaningful. Git accepts revision arguments according to documented revision-set rules, and the order of an explicit sequence should be verified rather than guessed from how a range expression looks. For a beginner’s lab, apply a short inspected sequence one commit at a time so the dependency and checks remain visible.
This is not a recommendation to split every transfer into many commands. A larger maintenance workflow may use a reviewed sequence and automated tests. The educational job is to understand that multiple patches form a history with dependencies, not a bag of interchangeable text edits.
Practice: find the missing prerequisite
Commit B adds const title = normaliseTitle(rawTitle);. The target has rawTitle but no definition or import of normaliseTitle. A clean cherry-pick of B is not sufficient evidence. Identify the prerequisite, inspect commit A and decide whether the target should adopt the helper. If it should, apply or recreate the necessary change in an order that can be tested. If it should not, redesign the selected fix for the target rather than leaving an unresolved name.
CHAPTER 7 OF 21 · Inspect and recover
7. Continue only after every conflict is genuinely resolved
Conflict markers are evidence of an unfinished decision
During a conflicted cherry-pick, Git places marker lines around competing content in affected text files. These markers show regions requiring a decision. Deleting the marker syntax without understanding the surrounding code can produce a syntactically clean but logically wrong file.
Use status to identify unmerged paths. For each path, compare the target context, the selected change and the intended final behaviour. Edit the file to one coherent result, run the most local relevant check and inspect the diff. Stage the file only after it represents the intended resolution. When every unmerged path is resolved and staged, git cherry-pick --continue can complete the operation.
The words “ours” and “theirs” can be confusing across different Git operations. Do not reduce the decision to a memorised side label. Read the actual content and history. The current target branch may contain important later context, while the selected commit contributes a particular change that must be adapted.
A successful continuation still needs final verification
The continue command records the resolved result, but Git cannot know the project’s complete behavioural intention. Run the relevant tests, render the changed output when appropriate and inspect the resulting commit. If the resolution removed a target-specific line or duplicated an operation, a green textual merge alone will not reveal every problem.
Practice: explain the staged result
A conflict contains a target heading “Weekly Practice Record” and a selected patch’s heading “Practice Log”. The target must retain its weekly scope while adopting a spelling correction elsewhere. The learner should explain why the resolved heading remains target-specific, show the other intended correction and demonstrate that no conflict markers remain. “I chose ours” is not a sufficient explanation of the result.
Abort returns to the pre-sequence state
The manual describes git cherry-pick --abort as cancelling the operation and returning to the pre-sequence state. In a controlled lab, record the target commit and file content before creating a conflict. After aborting, verify that HEAD and the files match that recorded state. This makes recovery an observed property rather than a slogan.
Abort is appropriate when the in-progress sequence should not be completed and the learner wants the repository restored to its starting state for that sequence. Check status afterwards. If unrelated work existed before the exercise, recovery can be more complicated, which is another reason to begin from a clean lab state.
Quit forgets the sequencer state
git cherry-pick --quit forgets the current sequencer operation. It does not promise the same restoration as abort. Files or index changes already produced by the attempt may remain. Use quit when the intended job is to stop Git’s sequencer management while deliberately retaining the current working state for inspection or another plan.
For a beginner, this distinction deserves an explicit lab rather than experimentation in important work. Create a disposable conflict, inspect status, try the chosen recovery operation and compare the result with the recorded start. The evidence should include both repository state and file content.
Skip omits the current commit in a sequence
git cherry-pick --skip moves past the current commit in a sequence. Skipping is not the same as resolving its change. If later commits depend on the skipped change, the sequence can fail later or produce incomplete behaviour. Before skipping, explain why the selected commit is unnecessary on this target and how the remaining sequence will be verified.
Practice: choose the recovery job
The learner started a two-commit sequence on the wrong branch and wants to return to the state before it began. Abort matches that goal. In a separate lab, the learner wants to stop sequencer control but deliberately inspect the partial changes that were applied; quit is the relevant concept, with careful status and diff checks. A redundant commit in a reviewed sequence may be skipped only after its absence is understood. The command follows the intended state, not the other way around.
CHAPTER 9 OF 21 · Inspect and recover
9. Understand initially empty and newly redundant commits
Empty can describe two different histories
An initially empty commit records the same tree as its parent at the time it was created. Teams sometimes use such commits as markers or workflow signals. A different situation occurs when a non-empty source commit becomes redundant on the target because its change is already present there.
Git’s current manual distinguishes these cases. --allow-empty preserves commits that were initially empty. The --empty=drop|keep|stop option governs commits that become empty because their changes are already in the target history; the default described for that option is to stop. Version availability matters, so inspect the installed Git manual rather than assuming every environment supports the same options.
Stop and investigate before choosing a policy
When a cherry-pick becomes empty, ask why. Perhaps the fix was applied earlier under another commit. Perhaps a broader target change already solved the issue. Perhaps a conflict resolution removed the selected patch’s effect. These histories have different implications even though the resulting tree can be unchanged.
Keeping a redundant commit can preserve a record that a particular source change was considered, but it can also add noise. Dropping it can keep history compact, but the review process should still record why the patch was unnecessary when that fact matters. The article does not prescribe one team policy; it teaches the evidence required to apply one.
Practice: classify the empty case
A source commit intentionally contains no file change and marks a classroom release checkpoint. That is initially empty. Another source commit corrects a heading that the target already corrected independently. That commit becomes empty on this target. Use the appropriate current Git option only after identifying which case occurred and whether the project wants a marker commit, a dropped redundant change or a pause for review.
CHAPTER 10 OF 21 · Inspect and recover
10. Use no-commit mode to assemble an inspected change deliberately
-n applies changes without making each commit immediately
The --no-commit or -n option applies changes to the working tree and index without automatically creating the usual commit for each selected source commit. It can help an experienced maintainer combine or edit several compatible changes before recording a new commit. It also places more responsibility on the user to understand the accumulated state.
In a disposable lab, apply one small source commit with git cherry-pick -n <commit>. Inspect status and the staged diff. Confirm that HEAD has not advanced while the selected change appears in the index and working tree. Then either record a deliberate commit with an accurate message or restore the lab according to the exercise plan.
The resulting commit is explicitly the learner’s work
Git’s documentation notes that no-commit mode does not record CHERRY_PICK_HEAD; a later plain commit records the current user as author. This matches the idea that the user is assembling and changing their own result rather than reproducing the original commit unchanged. Preserve attribution or provenance information according to the project’s collaboration rules; do not assume a default generated message will explain a manually assembled patch.
Avoid combining changes merely to reduce the commit count
Several source commits may represent distinct behaviours, reviews or rollback units. Squashing them into one no-commit result can make history less informative. Conversely, several tiny preparatory commits may form one coherent maintenance fix on the target. The decision should follow the target’s review and recovery needs.
Practice: verify the index and HEAD separately
After git cherry-pick -n, git diff --cached should show the staged applied change, while git rev-parse HEAD should still identify the pre-action target commit. A learner who checks only the file may think the operation is already recorded. A learner who checks only the commit history may think nothing happened. Status, staged diff and HEAD together explain the intermediate state.
A commit is not the same thing as one file or one line. It is a snapshot transition with an author, message, parent relationship and a set of changed paths. Cherry-picking a commit asks Git to apply the effect of that transition to the current branch. Before doing so, inspect the entire selected change—not only the file named in a message or the fragment visible in a code review comment.
This is especially important when a small fix depends on an accompanying test, configuration adjustment, migration or documentation change. Copying only the obvious source file may produce a target branch that builds but behaves differently. Cherry-picking the whole commit may be correct when all those paths form one coherent change. It may be wrong when the source commit bundled unrelated work.
The diagnosis begins before the command:
- Identify the exact source commit by full or unambiguous object name.
- Inspect its parent and summary.
- Inspect the complete patch and changed-path list.
- State which user-visible or testable behaviour the change is meant to produce.
- Identify prerequisites already present or missing on the target branch.
Only then decide whether replaying that commit is the right operation.
Commit messages are clues, not proof of scope
A message such as “fix worksheet total” may sound narrow, but the commit could also rename a helper, change a fixture and update a configuration file. Conversely, a broad-sounding message may contain a single guarded change. Read the actual diff.
Useful inspection commands include git show --stat <commit> for an overview and git show <commit> for the patch and metadata. git diff-tree --no-commit-id --name-status -r <commit> provides a path-oriented view for an ordinary non-merge commit. These commands answer complementary questions. A short statistic does not replace reading the changed content.
For binary files, Git may be unable to show a meaningful textual patch. A path can also be generated rather than authored. In those cases, follow the project’s build and review process. Do not assume that a binary size change is either safe or suspicious without context.
Separate prerequisites from coincidental history
If the selected commit calls a function introduced in an earlier commit, the earlier change is a prerequisite. If it merely happened earlier on the same branch but does not affect the selected behaviour, it is coincidental history. Chronological order alone does not decide dependency.
A practical check is to trace the names, interfaces, files and data structures used by the patch. Ask whether each exists in a compatible form on the target. Run the target branch’s tests before the cherry-pick to establish a baseline, then run the relevant and broader tests after it. A clean textual application is not proof that the semantic dependency is satisfied.
When several commits are necessary, preserve their dependency order. If the target project prefers one combined change, -n can stage them for an inspected commit, but that choice should follow the project’s review policy. Combining work can make later reversal harder, while preserving a long chain of tiny commits can make a maintenance branch noisy. There is no universal best commit count.
Watch for source-only files and target-specific equivalents
Branches can organise the same behaviour differently. A source branch may keep settings in config/current.yml, while the maintenance branch uses config/legacy.yml. Cherry-pick may report a path conflict, or it may create a new path that is syntactically valid but ignored by the target.
Conflict resolution must therefore preserve the intent in the target’s structure. Do not resolve by accepting “ours” or “theirs” across the whole file simply because the conflict markers disappear. Explain the intended behaviour, map it to the target design, stage the resolved files and test that behaviour.
This is also why a parent supervising a learner’s school coding project should encourage a disposable practice repository for Git mechanics. The real shared repository may have rules about branches, review and authorship. Learning the command safely does not grant permission to rewrite or publish collaborators’ work.
Verify deletions and renames deliberately
A selected commit can delete a path. That deletion may be the fix—for example, removing an obsolete configuration—or it may rely on a replacement introduced elsewhere. Inspect deletions with the same care as added lines.
Renames are inferred from content similarity; Git’s presentation of a change as a rename is not a permanent property stored in the commit. On a divergent target, the replay may appear as a deletion and addition or conflict differently. Verify the resulting paths and imports instead of relying only on the source diff label.
After a successful cherry-pick, check git status, inspect git show --stat HEAD, review git show HEAD and run the appropriate behaviour checks. If the selected commit was not intended to become the new HEAD—for example under -n—inspect the staged diff and confirm that HEAD is unchanged.
Practice: decide whether one commit is self-contained
A source commit changes calculator.js to call roundHalfUp(), adds a test for a boundary case and updates an example. The helper roundHalfUp() was introduced in the immediately preceding commit. The target branch does not have it.
Cherry-picking only the later commit is not self-contained even if a conflict does not occur. The learner should inspect the prerequisite commit and decide whether both changes belong on the target. If the target already has an equivalent helper under another name, the resolution may adapt the later patch instead of importing the earlier implementation. The correct decision is based on behaviour and target design, not merely commit order.
Now suppose the earlier commit only updates an unrelated colour theme. Its position in history does not make it a prerequisite. Cherry-picking it “just in case” widens the change and makes review harder.
Write the scope in the verification note
A concise verification note can record: the source object name; the target branch and pre-action HEAD; the changed paths expected; any prerequisite included; conflicts and how they were resolved; tests run; and the new object name. This is not bureaucratic padding. It lets another person distinguish an intentional replay from an accidental duplicate and makes recovery easier if the behaviour later proves wrong.
CHAPTER 12 OF 21 · Check deeper cases
12. Understand why a merge commit needs a parent choice
A merge has more than one comparison point
For a simple commit with one parent, the selected change is understood relative to that parent. A merge commit has several parents. Cherry-picking it therefore requires a deliberate choice of which parent is the mainline for the replay.
The -m option selects a parent number, beginning at one. It does not select a branch by name or mean “take the merge's message”. Inspect the merge's parents and the diff relative to the chosen parent before deciding that it represents the change you need.
If the first parent represents the receiving branch before a merge, the diff against it may include the incoming branch's changes and conflict-resolution work. The diff against the second parent describes a different comparison. Choosing one without inspection can import much more or much less than intended.
For a beginner's first lab, use ordinary single-parent commits. Introduce merge-parent reasoning only when the actual project requires it. A student who has not yet learned what a parent represents should not be expected to choose a merge mainline by copying a command.
Sometimes selecting the original focused commits is clearer than replaying the merge as one unit. Sometimes the merge's integrated result is precisely what the target needs. The right choice depends on dependencies, target design and the intended behaviour, not on which command is shorter.
Practice: explain what parent one means
A learner says parent one is always the main branch. That is not a reliable general rule. Parent ordering belongs to the merge commit's history. Read the actual object and compare the relevant trees. Branch names may have moved or changed since the merge was created.
The learner's explanation should name the comparison: “I want the change from this parent tree to the merge's tree.” That statement makes the proposed replay reviewable.
A replayed change normally has a different commit identity because it occupies a different place in history. That does not make the change the receiving student's original invention. Keep the source and any attribution required by the project.
The -x option adds a source-commit reference to the new commit message for traceability in the circumstances described by Git's manual. Inspect the resulting message, particularly after conflicts. A provenance note is useful when collaborators can access and understand the referenced source history.
Authorship and committer identity have different roles. The source author created the original change; the person making the replay records a new commit in the receiving history. Do not rewrite these identities to claim another person's work. Use the project's conventions when recording substantial adaptation.
Git history does not decide school submission rules. A technically successful cherry-pick can still be inappropriate for an individual assessment if it imports work that the student is not permitted to submit. Check the task's collaboration and attribution instructions before using another person's change.
In the local practice exercises, invented files and a disposable repository make the technical learning independent of a live collaboration. There is no need to publish a repository, contact another person or copy a classmate's project to understand how replay works.
Practice: write a useful adaptation note
Suppose the source fix uses a helper that the target does not have. The receiving student adapts the patch to an existing target helper and changes a test. A useful note identifies the original fix, explains the adaptation and records the target-specific verification. “Copied fix” alone loses the reason for the changed implementation.
CHAPTER 14 OF 21 · Check deeper cases
14. Check behaviour even when the patch applies cleanly
A clean cherry-pick means Git could apply the change without requiring manual conflict resolution. It does not establish that the programme builds, that tests pass or that the selected behaviour is appropriate for the receiving branch.
Consider a fix that changes a display string. On the source branch, the interface uses that string directly. On the target, a translation table supplies the visible label. The patch can apply cleanly while leaving the displayed text unchanged. The behaviour check should follow the user's actual path through the interface.
A numerical fix can also depend on units, defaults or a helper introduced earlier. A clean textual application may preserve syntax while changing the wrong quantity. Inspect the selected commit's context and the target's current interpretation of the affected field.
Choose checks that match the change. For a heading correction, open the generated page or test the string the user sees. For a calculation fix, test the numerical boundary and a normal case. For a deleted file, confirm that no target import or build step still requires it.
Do not broaden verification without purpose. The aim is evidence that the selected correction works here and that relevant neighbouring behaviour remains sound. A meaningful targeted test is more informative than repeatedly running an unrelated command until the learner feels reassured.
Practice: define a before-and-after test
The intended fix prevents a zero count from causing division by zero. Record the target's behaviour for zero before applying the change, then check the repaired response and a positive count afterwards. If the target uses a different meaning for zero, adapt the behaviour deliberately rather than assuming the source's policy transfers unchanged.
CHAPTER 15 OF 21 · Check deeper cases
15. Retry by inspecting state, not by repeating a command
A terminal can stop showing output, a process can be interrupted or a learner can forget whether a command completed. Before issuing another cherry-pick, inspect the repository. The selected change may already be applied, a conflict may be active or the working tree may contain an unfinished no-commit replay.
Start with git status. Then inspect the current branch, HEAD and recent history. If the expected new commit exists, review its content and behaviour rather than creating a second application. If a cherry-pick sequence is in progress, decide whether to resolve, continue, skip or abort according to its state.
Record the pre-action HEAD in the lab before beginning. That provides a concrete comparison point. The object identity is more precise than relying on the remembered branch label or the appearance of a file in the editor.
An empty replay can mean the change is already represented in the target, but do not assume that from the error alone. Compare the relevant content and history. A later target change might also have made the old patch obsolete or changed its intended meaning.
The purpose of the retry is to complete one intended transfer. Repeating the command without inspecting state can create unnecessary conflicts, duplicate history or confusion about which result should be tested.
Practice: inspect a suspected success
The learner sees the corrected heading and believes the cherry-pick succeeded. Ask for the current branch, the new commit and a clean status. If the heading was manually edited earlier but not committed, its appearance alone does not establish the replay's state.
CHAPTER 16 OF 21 · Complete the labs
16. Complete a clean replay lab from an independent starting point
Use a new disposable directory that contains no important work. Initialise a repository on a branch named stable, set a local practice identity and create a text file containing an invented misspelt heading. Commit that initial file.
Create a branch named experiment. Correct the heading and commit only that correction. Record this commit's object name. Then make a second, unrelated change, such as adding an unfinished feature note, and commit it separately.
Switch back to stable. Confirm the misspelt heading is still present and the unrelated feature note is absent. These observations establish the starting condition of the receiving branch. Record its HEAD and check that the working tree is clean.
Cherry-pick the recorded correction commit, not the current experiment branch tip. Inspect the heading, the changed-path list and the new commit's parent. The heading should be corrected, the unrelated feature note should remain absent and the new commit should follow the receiving branch's previous HEAD.
This lab teaches selection. If the learner instead merges the whole experiment branch, the unrelated work may arrive too. If they cherry-pick the latest commit, they may bring only the feature note. Both mistakes can be diagnosed by comparing the intended change with the selected object.
For a deliberately diverged target, the replayed correction normally has a different identity from its source. If the target's history allows special fast-forward behaviour and the corresponding option is used, history can behave differently. Keep the beginner lab's conditions explicit rather than making an absolute claim about every invocation.
Explain the result before moving on
Ask the learner to identify the original source commit, the receiving branch's previous commit and the resulting commit. Then ask which source changes were excluded. A correct explanation connects history to files; a copied object name alone does not show selection skill.
Start another disposable branch from the initial misspelt-heading commit. On this receiving branch, change the same heading to a different valid title and commit it. The selected source correction now competes with the target's own line change.
Cherry-picking the original correction can produce a conflict. Inspect git status and the affected file. Read both proposed headings and state the target's intended meaning. A conflict marker is not an instruction to choose whichever side looks newer.
For the first recovery exercise, abort the sequence and confirm that the receiving branch's committed heading and pre-action HEAD are restored. This demonstrates the meaning of abort under the lab's clean starting conditions.
For a second attempt, resolve the heading according to the chosen target design, remove the conflict markers and stage the resolved file. Inspect the staged diff. Continue only when that diff expresses the intended result.
After continuation, inspect the new history and test the visible heading. If the resolution simply kept the target's existing text, the replay may become empty; stop and follow the explicit empty-change policy rather than forcing an unexplained commit.
This exercise should remain local and disposable. It teaches recovery without making the family's real project the experiment. Important work requires a separate inspection of uncommitted changes and the project's collaboration rules.
Practice: choose between abort and quit
The learner wants to return to the pre-sequence branch state. Abort is the relevant operation. Quit forgets the sequencer's bookkeeping while leaving the current working state, so it does not express the same recovery goal.
The explained answer should name both the desired state and the chosen operation. That is more reliable than memorising three recovery flags as interchangeable ways to remove an error message.
A maintenance branch can have a legitimate reason to receive a small correction while excluding experimental features. For a proposed school-project lab, imagine a version already demonstrated to a teacher and another branch containing unfinished enhancements.
Begin with the specific defect in the demonstrated version. Write a test or reproducible observation that shows it. Then identify the source commit that corrects that behaviour and inspect any prerequisites.
If the fix is self-contained, replay it onto a clean maintenance branch and verify the original defect there. If it depends on unfinished feature work, decide whether a smaller target-specific repair is clearer. Cherry-pick is one method of transferring a correction, not a requirement to import every dependency blindly.
Keep the receiving branch's purpose visible. A branch intended only for a heading correction should not acquire unrelated interface experiments. Review the changed-path list and the final diff against its pre-action state.
If the repository belongs to a group, agree on how the correction will be reviewed and integrated under the project's existing process. The local exercise here performs no remote push and sends no message. Technical practice can be completed before any real collaboration action is needed.
Practice: reject an attractive but wider change
The source commit fixes the heading and also rewrites navigation. The maintenance branch only needs the heading correction. A whole cherry-pick would widen the scope. Inspect whether the commit should be split on the source or whether a separately reviewed target repair is appropriate. The learner should explain the trade-off rather than assuming every useful commit is appropriately sized.
CHAPTER 19 OF 21 · Practise and decide
19. A parent-friendly review of the learning evidence
A Punggol family's available study time depends on schoolwork, CCA, travel and rest. This topic is best practised when the learner already has enough command-line and repository understanding to interpret a small history. It does not need to become an additional compulsory task for every child.
In a short review, ask the learner to show one chosen correction and one change deliberately excluded. Then ask them to identify the destination before running anything. Those two questions reveal whether they understand both selection and receiving context.
After the exercise, ask for the evidence of completion: the current branch, status, changed files, history and a relevant behaviour check. A successful terminal message alone is insufficient. Conversely, a conflict is not evidence that the learner has failed; it creates a specific question about competing changes.
If the learner cannot distinguish a commit from a branch, return to that foundation. If they understand selection but miss prerequisites, practise reading a small diff and identifying dependencies. If they understand both but retry blindly, focus on state inspection and recovery.
Use How Studying Works for an explain–practise–correct routine. Return with one small change to predict or repair. The useful outcome is independent control of the task, not a long list of commands copied into a notebook.
CHAPTER 20 OF 21 · Practise and decide
20. Diagnostic practice with explained answers
The wrong branch receives the change
The learner selected the right source commit but remained on experiment. Cherry-pick applies to the current branch. Inspect the resulting state before recovery, preserve any work that needs preserving and repeat the lab only from the intended clean destination.
The patch applies but the test fails
Inspect the target's dependencies and behaviour. Clean application establishes a textual result, not a working programme. A missing helper, different default or changed data meaning can explain the failure.
A conflict resolution removes a target feature
The learner chose the entire incoming file without reviewing target-specific content. Revisit the intended merged result and inspect the staged diff. Resolve individual meanings rather than treating one whole side as automatically correct.
The replay becomes empty
Determine whether the target already contains the change, the resolution discarded it or the selected commit was initially empty. These cases have different meanings. Choose the documented empty-change policy deliberately and record why.
No-commit mode changes files without moving HEAD
That is consistent with its purpose. Inspect the staged diff and create a deliberate final commit when the assembled change is ready. Do not report a new commit merely because the working files look corrected.
A merge commit is selected without -m
The learner has not specified which parent comparison should define the replay. Inspect the parents and intended change before choosing a mainline. Copying -m 1 without understanding the history does not settle the question.
CHAPTER 21 OF 21 · Practise and decide
21. Frequently asked questions and further reading
Is cherry-pick the same as merge?
Cherry-pick selects changes introduced by particular commits. Merge combines histories according to the chosen branches and their relationship. Decide whether the task needs a focused correction or broader history integration.
Does it delete the source commit?
No. Replaying a change on the current branch does not remove the source commit from its history. The receiving branch gains the selected effect under the operation's chosen conditions.
Is a new commit name proof that the code works?
No. It identifies an object in history. Inspect the files and verify the relevant behaviour. Identity, scope and functionality are separate parts of the completion check.
Should a beginner start with merge commits?
A single-parent, local, disposable lab is easier to explain. Introduce merge-parent selection when the learner can interpret the history and the real task requires it.
Use the official Git cherry-pick manual for options and recovery semantics, Git show documentation for inspecting selected changes and Git status documentation for reading the working state. Check the installed Git version when using version-dependent options.
The final learning test is practical: can the learner select one justified change, apply it to the intended branch, explain any adaptation and demonstrate the resulting behaviour? When those steps are clear, the command serves a purpose the family can understand.

