Small Group Tutorials

Here to help students catch up, keep up, and move ahead. Book a consultation here.

How to Master Git diff-index in Punggol Tuition

HDB flats and road in Punggol

When a learner can reproduce a familiar example but a small variation causes confusion, the problem is usually an incomplete model rather than a lack of effort. The fastest useful response is to expose the hidden state and test one boundary at a time.

git diff-index compares a tree object, commonly HEAD, with either the working tree considered through the index or the index alone. Without –cached, it reports tracked paths whose working-tree state differs from the named tree; with –cached, it compares the named tree directly with the staged index, which represents what git write-tree would record. Untracked files are outside this comparison. Output options can show patches, names, statuses or raw records, while –quiet and –exit-code make the command useful in scripts. Mastery means naming both sides before running it, separating staged from unstaged evidence, refreshing stale index metadata when needed, and using NUL-delimited output whenever pathnames are machine-parsed. This guide begins with that mechanism, then develops it through worked traces, deliberate mistakes, explained practice and transfer decisions.

The aim is independent reasoning. A learner should be able to predict behaviour, locate the earliest wrong assumption, use a safe diagnostic procedure and defend a design choice in a new project.

Punggol families can use the guide in short sessions around homework, CCAs and rest. The activities are proposed learning exercises, not claims about a physical branch, timetable, class size, fee, school relationship or guaranteed result.

Use disposable data and repositories, preserve backups, and check version-sensitive details against the official source. Current documentation settles a technical contract; observation and explanation turn that contract into usable knowledge.

Find your next learning step

Choose the route that matches the present difficulty. Use the complete index for a systematic course.

Build the model

Chapters 1-4 . Begin here, then continue after the learner can predict, verify and explain.

Use the core tools

Chapters 5-8 . Begin here, then continue after the learner can predict, verify and explain.

Handle boundaries

Chapters 9-12 . Begin here, then continue after the learner can predict, verify and explain.

Debug and verify

Chapters 13-16 . Begin here, then continue after the learner can predict, verify and explain.

Transfer with judgment

Chapters 17-20 . Begin here, then continue after the learner can predict, verify and explain.

Open the full chapter index . Jump to capstone practice . Use the How Studying Works hub . Read the official documentation

CHAPTER 1 OF 20 . Build the model

1. diff-index needs a tree side

Back to contents

The command compares a named tree-ish such as HEAD against another repository state. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is running it without deciding which historical snapshot is the baseline. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for diff-index needs a tree side, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the diff-index needs a tree side chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on running it without deciding which historical snapshot is the baseline. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git diff-index HEAD

Explained result. HEAD supplies the committed tree used as the left side of the comparison. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework repository. Predict the rule using a learner separates staged work from an unstaged correction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The command compares a named tree-ish such as HEAD against another repository state.” Apply this procedure: State the contract for diff-index needs a tree side, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: HEAD supplies the committed tree used as the left side of the comparison. For the homework repository, add one near-miss that exposes running it without deciding which historical snapshot is the baseline. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading notes. Contrast the rule using one pathspec limits evidence to the current chapter folder. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The command compares a named tree-ish such as HEAD against another repository state.” Apply this procedure: State the contract for diff-index needs a tree side, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: HEAD supplies the committed tree used as the left side of the comparison. For the reading notes, add one near-miss that exposes running it without deciding which historical snapshot is the baseline. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: science project. Stress-test the rule using an automated check uses exit status without printing a patch. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The command compares a named tree-ish such as HEAD against another repository state.” Apply this procedure: State the contract for diff-index needs a tree side, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: HEAD supplies the committed tree used as the left side of the comparison. For the science project, add one near-miss that exposes running it without deciding which historical snapshot is the baseline. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: CCA website. Explain the rule using renames and deletions are reported with machine-safe names. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The command compares a named tree-ish such as HEAD against another repository state.” Apply this procedure: State the contract for diff-index needs a tree side, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: HEAD supplies the committed tree used as the left side of the comparison. For the CCA website, add one near-miss that exposes running it without deciding which historical snapshot is the baseline. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers running it without deciding which historical snapshot is the baseline.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for diff-index needs a tree side, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from diff-index needs a tree side?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing running it without deciding which historical snapshot is the baseline be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny library catalogue with raw records explain modes, object IDs and status fields. Include one ordinary case, one boundary and one deliberate failure caused by running it without deciding which historical snapshot is the baseline. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: The command compares a named tree-ish such as HEAD against another repository state. It shows a trace, not only a final value. The ordinary case should demonstrate “HEAD supplies the committed tree used as the left side of the comparison.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for diff-index needs a tree side, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For diff-index needs a tree side, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 2 OF 20 . Build the model

2. Default mode considers the working tree through the index

Back to contents

Without –cached, Git uses the index plus working-tree checks to find tracked paths different from the named tree. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is describing the operation as a direct byte comparison that ignores index state. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Default mode considers the working tree through the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Default mode considers the working tree through the index chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on describing the operation as a direct byte comparison that ignores index state. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

printf 'change
' >> notes.txt
git diff-index --name-status HEAD --

Explained result. A tracked modified path is reported relative to HEAD. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: science project. Contrast the rule using an automated check uses exit status without printing a patch. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Without –cached, Git uses the index plus working-tree checks to find tracked paths different from the named tree.” Apply this procedure: State the contract for Default mode considers the working tree through the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: A tracked modified path is reported relative to HEAD. For the science project, add one near-miss that exposes describing the operation as a direct byte comparison that ignores index state. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: CCA website. Stress-test the rule using renames and deletions are reported with machine-safe names. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Without –cached, Git uses the index plus working-tree checks to find tracked paths different from the named tree.” Apply this procedure: State the contract for Default mode considers the working tree through the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: A tracked modified path is reported relative to HEAD. For the CCA website, add one near-miss that exposes describing the operation as a direct byte comparison that ignores index state. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: family archive. Explain the rule using untracked scans are kept separate from tracked-tree comparisons. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Without –cached, Git uses the index plus working-tree checks to find tracked paths different from the named tree.” Apply this procedure: State the contract for Default mode considers the working tree through the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: A tracked modified path is reported relative to HEAD. For the family archive, add one near-miss that exposes describing the operation as a direct byte comparison that ignores index state. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library catalogue. Transfer the rule using raw records explain modes, object IDs and status fields. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Without –cached, Git uses the index plus working-tree checks to find tracked paths different from the named tree.” Apply this procedure: State the contract for Default mode considers the working tree through the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: A tracked modified path is reported relative to HEAD. For the library catalogue, add one near-miss that exposes describing the operation as a direct byte comparison that ignores index state. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers describing the operation as a direct byte comparison that ignores index state.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Default mode considers the working tree through the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Default mode considers the working tree through the index?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing describing the operation as a direct byte comparison that ignores index state be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny test laboratory with cached, non-cached, quiet, refresh and missing-file cases expose boundaries. Include one ordinary case, one boundary and one deliberate failure caused by describing the operation as a direct byte comparison that ignores index state. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Without –cached, Git uses the index plus working-tree checks to find tracked paths different from the named tree. It shows a trace, not only a final value. The ordinary case should demonstrate “A tracked modified path is reported relative to HEAD.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Default mode considers the working tree through the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Default mode considers the working tree through the index, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 3 OF 20 . Build the model

3. Cached mode compares the tree to the index

Back to contents

With –cached, the right side is the staged index, the state that write-tree would record. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is expecting unstaged edits to appear in a cached comparison. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Cached mode compares the tree to the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Cached mode compares the tree to the index chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on expecting unstaged edits to appear in a cached comparison. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git add notes.txt
printf 'later
' >> notes.txt
git diff-index --cached --name-status HEAD --

Explained result. The staged version is compared with HEAD; the later unstaged edit is not part of this cached result. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: family archive. Stress-test the rule using untracked scans are kept separate from tracked-tree comparisons. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With –cached, the right side is the staged index, the state that write-tree would record.” Apply this procedure: State the contract for Cached mode compares the tree to the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The staged version is compared with HEAD; the later unstaged edit is not part of this cached result. For the family archive, add one near-miss that exposes expecting unstaged edits to appear in a cached comparison. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library catalogue. Explain the rule using raw records explain modes, object IDs and status fields. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With –cached, the right side is the staged index, the state that write-tree would record.” Apply this procedure: State the contract for Cached mode compares the tree to the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The staged version is compared with HEAD; the later unstaged edit is not part of this cached result. For the library catalogue, add one near-miss that exposes expecting unstaged edits to appear in a cached comparison. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Transfer the rule using cached, non-cached, quiet, refresh and missing-file cases expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With –cached, the right side is the staged index, the state that write-tree would record.” Apply this procedure: State the contract for Cached mode compares the tree to the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The staged version is compared with HEAD; the later unstaged edit is not part of this cached result. For the test laboratory, add one near-miss that exposes expecting unstaged edits to appear in a cached comparison. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Predict the rule using diff-index is compared with git diff, status, write-tree and ls-files. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With –cached, the right side is the staged index, the state that write-tree would record.” Apply this procedure: State the contract for Cached mode compares the tree to the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The staged version is compared with HEAD; the later unstaged edit is not part of this cached result. For the tool decision, add one near-miss that exposes expecting unstaged edits to appear in a cached comparison. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers expecting unstaged edits to appear in a cached comparison.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Cached mode compares the tree to the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Cached mode compares the tree to the index?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing expecting unstaged edits to appear in a cached comparison be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny tool decision with diff-index is compared with git diff, status, write-tree and ls-files. Include one ordinary case, one boundary and one deliberate failure caused by expecting unstaged edits to appear in a cached comparison. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: With –cached, the right side is the staged index, the state that write-tree would record. It shows a trace, not only a final value. The ordinary case should demonstrate “The staged version is compared with HEAD; the later unstaged edit is not part of this cached result.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Cached mode compares the tree to the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Cached mode compares the tree to the index, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 4 OF 20 . Build the model

4. Staged and unstaged questions are different

Back to contents

A staged change can appear in both the cached comparison and the default tree-to-working-state view, while an unstaged-only edit is absent from –cached. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is using one command mode to answer both questions without naming its sides. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Staged and unstaged questions are different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Staged and unstaged questions are different chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on using one command mode to answer both questions without naming its sides. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git diff-index --cached --name-only HEAD --
git diff-index --name-only HEAD --

Explained result. The two outputs answer tree-versus-index and tree-versus-current-tracked-state questions respectively. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: test laboratory. Explain the rule using cached, non-cached, quiet, refresh and missing-file cases expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A staged change can appear in both the cached comparison and the default tree-to-working-state view, while an unstaged-only edit is absent from –cached.” Apply this procedure: State the contract for Staged and unstaged questions are different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The two outputs answer tree-versus-index and tree-versus-current-tracked-state questions respectively. For the test laboratory, add one near-miss that exposes using one command mode to answer both questions without naming its sides. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Transfer the rule using diff-index is compared with git diff, status, write-tree and ls-files. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A staged change can appear in both the cached comparison and the default tree-to-working-state view, while an unstaged-only edit is absent from –cached.” Apply this procedure: State the contract for Staged and unstaged questions are different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The two outputs answer tree-versus-index and tree-versus-current-tracked-state questions respectively. For the tool decision, add one near-miss that exposes using one command mode to answer both questions without naming its sides. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework repository. Predict the rule using a learner separates staged work from an unstaged correction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A staged change can appear in both the cached comparison and the default tree-to-working-state view, while an unstaged-only edit is absent from –cached.” Apply this procedure: State the contract for Staged and unstaged questions are different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The two outputs answer tree-versus-index and tree-versus-current-tracked-state questions respectively. For the homework repository, add one near-miss that exposes using one command mode to answer both questions without naming its sides. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading notes. Contrast the rule using one pathspec limits evidence to the current chapter folder. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A staged change can appear in both the cached comparison and the default tree-to-working-state view, while an unstaged-only edit is absent from –cached.” Apply this procedure: State the contract for Staged and unstaged questions are different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The two outputs answer tree-versus-index and tree-versus-current-tracked-state questions respectively. For the reading notes, add one near-miss that exposes using one command mode to answer both questions without naming its sides. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers using one command mode to answer both questions without naming its sides.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Staged and unstaged questions are different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Staged and unstaged questions are different?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using one command mode to answer both questions without naming its sides be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny homework repository with a learner separates staged work from an unstaged correction. Include one ordinary case, one boundary and one deliberate failure caused by using one command mode to answer both questions without naming its sides. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: A staged change can appear in both the cached comparison and the default tree-to-working-state view, while an unstaged-only edit is absent from –cached. It shows a trace, not only a final value. The ordinary case should demonstrate “The two outputs answer tree-versus-index and tree-versus-current-tracked-state questions respectively.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Staged and unstaged questions are different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Staged and unstaged questions are different, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 5 OF 20 . Use the core tools

5. Untracked files are not diff-index entries

Back to contents

Files absent from the index and named tree are not discovered by this tree/index comparison. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is treating a clean diff-index result as proof that the working directory has no untracked files. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Untracked files are not diff-index entries, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Untracked files are not diff-index entries chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on treating a clean diff-index result as proof that the working directory has no untracked files. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

printf 'new
' > untracked.txt
git diff-index --name-only HEAD --
git ls-files --others --exclude-standard

Explained result. The first command can be silent while ls-files reports the untracked path. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework repository. Transfer the rule using a learner separates staged work from an unstaged correction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Files absent from the index and named tree are not discovered by this tree/index comparison.” Apply this procedure: State the contract for Untracked files are not diff-index entries, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The first command can be silent while ls-files reports the untracked path. For the homework repository, add one near-miss that exposes treating a clean diff-index result as proof that the working directory has no untracked files. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading notes. Predict the rule using one pathspec limits evidence to the current chapter folder. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Files absent from the index and named tree are not discovered by this tree/index comparison.” Apply this procedure: State the contract for Untracked files are not diff-index entries, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The first command can be silent while ls-files reports the untracked path. For the reading notes, add one near-miss that exposes treating a clean diff-index result as proof that the working directory has no untracked files. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: science project. Contrast the rule using an automated check uses exit status without printing a patch. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Files absent from the index and named tree are not discovered by this tree/index comparison.” Apply this procedure: State the contract for Untracked files are not diff-index entries, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The first command can be silent while ls-files reports the untracked path. For the science project, add one near-miss that exposes treating a clean diff-index result as proof that the working directory has no untracked files. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: CCA website. Stress-test the rule using renames and deletions are reported with machine-safe names. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Files absent from the index and named tree are not discovered by this tree/index comparison.” Apply this procedure: State the contract for Untracked files are not diff-index entries, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The first command can be silent while ls-files reports the untracked path. For the CCA website, add one near-miss that exposes treating a clean diff-index result as proof that the working directory has no untracked files. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers treating a clean diff-index result as proof that the working directory has no untracked files.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Untracked files are not diff-index entries, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Untracked files are not diff-index entries?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing treating a clean diff-index result as proof that the working directory has no untracked files be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny reading notes with one pathspec limits evidence to the current chapter folder. Include one ordinary case, one boundary and one deliberate failure caused by treating a clean diff-index result as proof that the working directory has no untracked files. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Files absent from the index and named tree are not discovered by this tree/index comparison. It shows a trace, not only a final value. The ordinary case should demonstrate “The first command can be silent while ls-files reports the untracked path.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Untracked files are not diff-index entries, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Untracked files are not diff-index entries, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 6 OF 20 . Use the core tools

6. A pathspec narrows the comparison

Back to contents

Arguments after — can limit reporting to selected paths or directories. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is forgetting the separator and letting a path resemble an option or revision. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for A pathspec narrows the comparison, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the A pathspec narrows the comparison chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on forgetting the separator and letting a path resemble an option or revision. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git diff-index --name-only HEAD -- chapter-one/

Explained result. Only matching tracked paths under chapter-one are considered for output. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: science project. Predict the rule using an automated check uses exit status without printing a patch. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Arguments after — can limit reporting to selected paths or directories.” Apply this procedure: State the contract for A pathspec narrows the comparison, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Only matching tracked paths under chapter-one are considered for output. For the science project, add one near-miss that exposes forgetting the separator and letting a path resemble an option or revision. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: CCA website. Contrast the rule using renames and deletions are reported with machine-safe names. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Arguments after — can limit reporting to selected paths or directories.” Apply this procedure: State the contract for A pathspec narrows the comparison, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Only matching tracked paths under chapter-one are considered for output. For the CCA website, add one near-miss that exposes forgetting the separator and letting a path resemble an option or revision. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: family archive. Stress-test the rule using untracked scans are kept separate from tracked-tree comparisons. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Arguments after — can limit reporting to selected paths or directories.” Apply this procedure: State the contract for A pathspec narrows the comparison, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Only matching tracked paths under chapter-one are considered for output. For the family archive, add one near-miss that exposes forgetting the separator and letting a path resemble an option or revision. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library catalogue. Explain the rule using raw records explain modes, object IDs and status fields. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Arguments after — can limit reporting to selected paths or directories.” Apply this procedure: State the contract for A pathspec narrows the comparison, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Only matching tracked paths under chapter-one are considered for output. For the library catalogue, add one near-miss that exposes forgetting the separator and letting a path resemble an option or revision. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers forgetting the separator and letting a path resemble an option or revision.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for A pathspec narrows the comparison, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from A pathspec narrows the comparison?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing forgetting the separator and letting a path resemble an option or revision be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny science project with an automated check uses exit status without printing a patch. Include one ordinary case, one boundary and one deliberate failure caused by forgetting the separator and letting a path resemble an option or revision. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Arguments after — can limit reporting to selected paths or directories. It shows a trace, not only a final value. The ordinary case should demonstrate “Only matching tracked paths under chapter-one are considered for output.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for A pathspec narrows the comparison, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For A pathspec narrows the comparison, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 7 OF 20 . Use the core tools

7. Name-only output is for path discovery

Back to contents

–name-only suppresses patch detail and prints the affected pathnames. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is parsing a full patch merely to obtain file names. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Name-only output is for path discovery, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Name-only output is for path discovery chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on parsing a full patch merely to obtain file names. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git diff-index --name-only HEAD --

Explained result. The output is a pathname list for changed tracked entries. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: family archive. Contrast the rule using untracked scans are kept separate from tracked-tree comparisons. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–name-only suppresses patch detail and prints the affected pathnames.” Apply this procedure: State the contract for Name-only output is for path discovery, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The output is a pathname list for changed tracked entries. For the family archive, add one near-miss that exposes parsing a full patch merely to obtain file names. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library catalogue. Stress-test the rule using raw records explain modes, object IDs and status fields. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–name-only suppresses patch detail and prints the affected pathnames.” Apply this procedure: State the contract for Name-only output is for path discovery, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The output is a pathname list for changed tracked entries. For the library catalogue, add one near-miss that exposes parsing a full patch merely to obtain file names. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Explain the rule using cached, non-cached, quiet, refresh and missing-file cases expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–name-only suppresses patch detail and prints the affected pathnames.” Apply this procedure: State the contract for Name-only output is for path discovery, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The output is a pathname list for changed tracked entries. For the test laboratory, add one near-miss that exposes parsing a full patch merely to obtain file names. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Transfer the rule using diff-index is compared with git diff, status, write-tree and ls-files. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–name-only suppresses patch detail and prints the affected pathnames.” Apply this procedure: State the contract for Name-only output is for path discovery, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The output is a pathname list for changed tracked entries. For the tool decision, add one near-miss that exposes parsing a full patch merely to obtain file names. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers parsing a full patch merely to obtain file names.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Name-only output is for path discovery, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Name-only output is for path discovery?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing parsing a full patch merely to obtain file names be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny CCA website with renames and deletions are reported with machine-safe names. Include one ordinary case, one boundary and one deliberate failure caused by parsing a full patch merely to obtain file names. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: –name-only suppresses patch detail and prints the affected pathnames. It shows a trace, not only a final value. The ordinary case should demonstrate “The output is a pathname list for changed tracked entries.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Name-only output is for path discovery, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Name-only output is for path discovery, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 8 OF 20 . Use the core tools

8. Name-status adds a change code

Back to contents

–name-status reports each selected path together with a status letter such as M, A or D. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is assuming every reported difference is a modification. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Name-status adds a change code, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Name-status adds a change code chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on assuming every reported difference is a modification. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git diff-index --cached --name-status HEAD --

Explained result. The status field distinguishes staged additions, modifications and deletions. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: test laboratory. Stress-test the rule using cached, non-cached, quiet, refresh and missing-file cases expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–name-status reports each selected path together with a status letter such as M, A or D.” Apply this procedure: State the contract for Name-status adds a change code, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The status field distinguishes staged additions, modifications and deletions. For the test laboratory, add one near-miss that exposes assuming every reported difference is a modification. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Explain the rule using diff-index is compared with git diff, status, write-tree and ls-files. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–name-status reports each selected path together with a status letter such as M, A or D.” Apply this procedure: State the contract for Name-status adds a change code, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The status field distinguishes staged additions, modifications and deletions. For the tool decision, add one near-miss that exposes assuming every reported difference is a modification. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework repository. Transfer the rule using a learner separates staged work from an unstaged correction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–name-status reports each selected path together with a status letter such as M, A or D.” Apply this procedure: State the contract for Name-status adds a change code, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The status field distinguishes staged additions, modifications and deletions. For the homework repository, add one near-miss that exposes assuming every reported difference is a modification. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading notes. Predict the rule using one pathspec limits evidence to the current chapter folder. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–name-status reports each selected path together with a status letter such as M, A or D.” Apply this procedure: State the contract for Name-status adds a change code, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The status field distinguishes staged additions, modifications and deletions. For the reading notes, add one near-miss that exposes assuming every reported difference is a modification. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers assuming every reported difference is a modification.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Name-status adds a change code, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Name-status adds a change code?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming every reported difference is a modification be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny family archive with untracked scans are kept separate from tracked-tree comparisons. Include one ordinary case, one boundary and one deliberate failure caused by assuming every reported difference is a modification. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: –name-status reports each selected path together with a status letter such as M, A or D. It shows a trace, not only a final value. The ordinary case should demonstrate “The status field distinguishes staged additions, modifications and deletions.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Name-status adds a change code, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Name-status adds a change code, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 9 OF 20 . Handle boundaries

9. Patch mode explains content changes

Back to contents

Adding -p or –patch asks the diff machinery to show patch hunks rather than only raw metadata. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is expecting default plumbing output to look like porcelain git diff. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Patch mode explains content changes, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Patch mode explains content changes chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on expecting default plumbing output to look like porcelain git diff. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git diff-index -p HEAD -- notes.txt

Explained result. The selected tracked path is shown with patch context and changed lines. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework repository. Explain the rule using a learner separates staged work from an unstaged correction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Adding -p or –patch asks the diff machinery to show patch hunks rather than only raw metadata.” Apply this procedure: State the contract for Patch mode explains content changes, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The selected tracked path is shown with patch context and changed lines. For the homework repository, add one near-miss that exposes expecting default plumbing output to look like porcelain git diff. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading notes. Transfer the rule using one pathspec limits evidence to the current chapter folder. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Adding -p or –patch asks the diff machinery to show patch hunks rather than only raw metadata.” Apply this procedure: State the contract for Patch mode explains content changes, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The selected tracked path is shown with patch context and changed lines. For the reading notes, add one near-miss that exposes expecting default plumbing output to look like porcelain git diff. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: science project. Predict the rule using an automated check uses exit status without printing a patch. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Adding -p or –patch asks the diff machinery to show patch hunks rather than only raw metadata.” Apply this procedure: State the contract for Patch mode explains content changes, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The selected tracked path is shown with patch context and changed lines. For the science project, add one near-miss that exposes expecting default plumbing output to look like porcelain git diff. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: CCA website. Contrast the rule using renames and deletions are reported with machine-safe names. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Adding -p or –patch asks the diff machinery to show patch hunks rather than only raw metadata.” Apply this procedure: State the contract for Patch mode explains content changes, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The selected tracked path is shown with patch context and changed lines. For the CCA website, add one near-miss that exposes expecting default plumbing output to look like porcelain git diff. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers expecting default plumbing output to look like porcelain git diff.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Patch mode explains content changes, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Patch mode explains content changes?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing expecting default plumbing output to look like porcelain git diff be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny library catalogue with raw records explain modes, object IDs and status fields. Include one ordinary case, one boundary and one deliberate failure caused by expecting default plumbing output to look like porcelain git diff. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Adding -p or –patch asks the diff machinery to show patch hunks rather than only raw metadata. It shows a trace, not only a final value. The ordinary case should demonstrate “The selected tracked path is shown with patch context and changed lines.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Patch mode explains content changes, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Patch mode explains content changes, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 10 OF 20 . Handle boundaries

10. Exit-code mode distinguishes equal from different

Back to contents

–exit-code follows diff convention: zero for no differences and one when differences exist. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is treating exit code one as a command failure that should always abort diagnostics. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Exit-code mode distinguishes equal from different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Exit-code mode distinguishes equal from different chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on treating exit code one as a command failure that should always abort diagnostics. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

if git diff-index --exit-code HEAD --quiet --; then echo clean; else echo different; fi

Explained result. The branch uses the documented difference status without printing output. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: science project. Transfer the rule using an automated check uses exit status without printing a patch. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–exit-code follows diff convention: zero for no differences and one when differences exist.” Apply this procedure: State the contract for Exit-code mode distinguishes equal from different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The branch uses the documented difference status without printing output. For the science project, add one near-miss that exposes treating exit code one as a command failure that should always abort diagnostics. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: CCA website. Predict the rule using renames and deletions are reported with machine-safe names. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–exit-code follows diff convention: zero for no differences and one when differences exist.” Apply this procedure: State the contract for Exit-code mode distinguishes equal from different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The branch uses the documented difference status without printing output. For the CCA website, add one near-miss that exposes treating exit code one as a command failure that should always abort diagnostics. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: family archive. Contrast the rule using untracked scans are kept separate from tracked-tree comparisons. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–exit-code follows diff convention: zero for no differences and one when differences exist.” Apply this procedure: State the contract for Exit-code mode distinguishes equal from different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The branch uses the documented difference status without printing output. For the family archive, add one near-miss that exposes treating exit code one as a command failure that should always abort diagnostics. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library catalogue. Stress-test the rule using raw records explain modes, object IDs and status fields. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–exit-code follows diff convention: zero for no differences and one when differences exist.” Apply this procedure: State the contract for Exit-code mode distinguishes equal from different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The branch uses the documented difference status without printing output. For the library catalogue, add one near-miss that exposes treating exit code one as a command failure that should always abort diagnostics. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers treating exit code one as a command failure that should always abort diagnostics.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Exit-code mode distinguishes equal from different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Exit-code mode distinguishes equal from different?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing treating exit code one as a command failure that should always abort diagnostics be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny test laboratory with cached, non-cached, quiet, refresh and missing-file cases expose boundaries. Include one ordinary case, one boundary and one deliberate failure caused by treating exit code one as a command failure that should always abort diagnostics. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: –exit-code follows diff convention: zero for no differences and one when differences exist. It shows a trace, not only a final value. The ordinary case should demonstrate “The branch uses the documented difference status without printing output.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Exit-code mode distinguishes equal from different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Exit-code mode distinguishes equal from different, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 11 OF 20 . Handle boundaries

11. Quiet mode suppresses normal output

Back to contents

–quiet disables output while retaining an exit status suitable for a conditional. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is redirecting complex patch output when no content was needed. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Quiet mode suppresses normal output, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Quiet mode suppresses normal output chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on redirecting complex patch output when no content was needed. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git diff-index --quiet HEAD --; code=$?; printf '%s
' "$code"

Explained result. The numeric status communicates whether a difference was found. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: family archive. Predict the rule using untracked scans are kept separate from tracked-tree comparisons. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–quiet disables output while retaining an exit status suitable for a conditional.” Apply this procedure: State the contract for Quiet mode suppresses normal output, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The numeric status communicates whether a difference was found. For the family archive, add one near-miss that exposes redirecting complex patch output when no content was needed. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library catalogue. Contrast the rule using raw records explain modes, object IDs and status fields. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–quiet disables output while retaining an exit status suitable for a conditional.” Apply this procedure: State the contract for Quiet mode suppresses normal output, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The numeric status communicates whether a difference was found. For the library catalogue, add one near-miss that exposes redirecting complex patch output when no content was needed. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Stress-test the rule using cached, non-cached, quiet, refresh and missing-file cases expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–quiet disables output while retaining an exit status suitable for a conditional.” Apply this procedure: State the contract for Quiet mode suppresses normal output, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The numeric status communicates whether a difference was found. For the test laboratory, add one near-miss that exposes redirecting complex patch output when no content was needed. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Explain the rule using diff-index is compared with git diff, status, write-tree and ls-files. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–quiet disables output while retaining an exit status suitable for a conditional.” Apply this procedure: State the contract for Quiet mode suppresses normal output, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The numeric status communicates whether a difference was found. For the tool decision, add one near-miss that exposes redirecting complex patch output when no content was needed. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers redirecting complex patch output when no content was needed.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Quiet mode suppresses normal output, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Quiet mode suppresses normal output?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing redirecting complex patch output when no content was needed be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny tool decision with diff-index is compared with git diff, status, write-tree and ls-files. Include one ordinary case, one boundary and one deliberate failure caused by redirecting complex patch output when no content was needed. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: –quiet disables output while retaining an exit status suitable for a conditional. It shows a trace, not only a final value. The ordinary case should demonstrate “The numeric status communicates whether a difference was found.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Quiet mode suppresses normal output, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Quiet mode suppresses normal output, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 12 OF 20 . Handle boundaries

12. Raw output exposes tree-entry facts

Back to contents

The raw format can include old and new modes, object names, status and pathname. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is reading colon-prefixed plumbing records as ordinary prose. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Raw output exposes tree-entry facts, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Raw output exposes tree-entry facts chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on reading colon-prefixed plumbing records as ordinary prose. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git diff-index --raw HEAD --

Explained result. Each record is structured diff data and should be parsed according to the documented raw format. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: test laboratory. Contrast the rule using cached, non-cached, quiet, refresh and missing-file cases expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The raw format can include old and new modes, object names, status and pathname.” Apply this procedure: State the contract for Raw output exposes tree-entry facts, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Each record is structured diff data and should be parsed according to the documented raw format. For the test laboratory, add one near-miss that exposes reading colon-prefixed plumbing records as ordinary prose. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Stress-test the rule using diff-index is compared with git diff, status, write-tree and ls-files. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The raw format can include old and new modes, object names, status and pathname.” Apply this procedure: State the contract for Raw output exposes tree-entry facts, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Each record is structured diff data and should be parsed according to the documented raw format. For the tool decision, add one near-miss that exposes reading colon-prefixed plumbing records as ordinary prose. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework repository. Explain the rule using a learner separates staged work from an unstaged correction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The raw format can include old and new modes, object names, status and pathname.” Apply this procedure: State the contract for Raw output exposes tree-entry facts, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Each record is structured diff data and should be parsed according to the documented raw format. For the homework repository, add one near-miss that exposes reading colon-prefixed plumbing records as ordinary prose. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading notes. Transfer the rule using one pathspec limits evidence to the current chapter folder. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The raw format can include old and new modes, object names, status and pathname.” Apply this procedure: State the contract for Raw output exposes tree-entry facts, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Each record is structured diff data and should be parsed according to the documented raw format. For the reading notes, add one near-miss that exposes reading colon-prefixed plumbing records as ordinary prose. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers reading colon-prefixed plumbing records as ordinary prose.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Raw output exposes tree-entry facts, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Raw output exposes tree-entry facts?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing reading colon-prefixed plumbing records as ordinary prose be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny homework repository with a learner separates staged work from an unstaged correction. Include one ordinary case, one boundary and one deliberate failure caused by reading colon-prefixed plumbing records as ordinary prose. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: The raw format can include old and new modes, object names, status and pathname. It shows a trace, not only a final value. The ordinary case should demonstrate “Each record is structured diff data and should be parsed according to the documented raw format.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Raw output exposes tree-entry facts, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Raw output exposes tree-entry facts, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 13 OF 20 . Debug and verify

13. Abbreviated object names are display choices

Back to contents

–abbrev controls displayed object-name length in diff raw formats without changing repository object identity. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is storing an abbreviated display as a permanent universal identifier. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Abbreviated object names are display choices, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Abbreviated object names are display choices chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on storing an abbreviated display as a permanent universal identifier. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git diff-index --raw --abbrev=12 HEAD --

Explained result. The shown IDs are shortened for output; scripts needing full identity should request or resolve full names. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework repository. Stress-test the rule using a learner separates staged work from an unstaged correction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–abbrev controls displayed object-name length in diff raw formats without changing repository object identity.” Apply this procedure: State the contract for Abbreviated object names are display choices, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The shown IDs are shortened for output; scripts needing full identity should request or resolve full names. For the homework repository, add one near-miss that exposes storing an abbreviated display as a permanent universal identifier. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading notes. Explain the rule using one pathspec limits evidence to the current chapter folder. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–abbrev controls displayed object-name length in diff raw formats without changing repository object identity.” Apply this procedure: State the contract for Abbreviated object names are display choices, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The shown IDs are shortened for output; scripts needing full identity should request or resolve full names. For the reading notes, add one near-miss that exposes storing an abbreviated display as a permanent universal identifier. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: science project. Transfer the rule using an automated check uses exit status without printing a patch. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–abbrev controls displayed object-name length in diff raw formats without changing repository object identity.” Apply this procedure: State the contract for Abbreviated object names are display choices, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The shown IDs are shortened for output; scripts needing full identity should request or resolve full names. For the science project, add one near-miss that exposes storing an abbreviated display as a permanent universal identifier. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: CCA website. Predict the rule using renames and deletions are reported with machine-safe names. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–abbrev controls displayed object-name length in diff raw formats without changing repository object identity.” Apply this procedure: State the contract for Abbreviated object names are display choices, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The shown IDs are shortened for output; scripts needing full identity should request or resolve full names. For the CCA website, add one near-miss that exposes storing an abbreviated display as a permanent universal identifier. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers storing an abbreviated display as a permanent universal identifier.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Abbreviated object names are display choices, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Abbreviated object names are display choices?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing storing an abbreviated display as a permanent universal identifier be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny reading notes with one pathspec limits evidence to the current chapter folder. Include one ordinary case, one boundary and one deliberate failure caused by storing an abbreviated display as a permanent universal identifier. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: –abbrev controls displayed object-name length in diff raw formats without changing repository object identity. It shows a trace, not only a final value. The ordinary case should demonstrate “The shown IDs are shortened for output; scripts needing full identity should request or resolve full names.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Abbreviated object names are display choices, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Abbreviated object names are display choices, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 14 OF 20 . Debug and verify

14. NUL termination protects unusual pathnames

Back to contents

Combining -z with a name or raw format terminates fields safely for machine parsing. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is splitting newline output when a valid pathname itself can contain a newline. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for NUL termination protects unusual pathnames, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the NUL termination protects unusual pathnames chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on splitting newline output when a valid pathname itself can contain a newline. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git diff-index --name-status -z HEAD -- > changes.bin

Explained result. The binary-style stream uses NUL boundaries rather than ambiguous line breaks. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: science project. Explain the rule using an automated check uses exit status without printing a patch. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Combining -z with a name or raw format terminates fields safely for machine parsing.” Apply this procedure: State the contract for NUL termination protects unusual pathnames, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The binary-style stream uses NUL boundaries rather than ambiguous line breaks. For the science project, add one near-miss that exposes splitting newline output when a valid pathname itself can contain a newline. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: CCA website. Transfer the rule using renames and deletions are reported with machine-safe names. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Combining -z with a name or raw format terminates fields safely for machine parsing.” Apply this procedure: State the contract for NUL termination protects unusual pathnames, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The binary-style stream uses NUL boundaries rather than ambiguous line breaks. For the CCA website, add one near-miss that exposes splitting newline output when a valid pathname itself can contain a newline. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: family archive. Predict the rule using untracked scans are kept separate from tracked-tree comparisons. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Combining -z with a name or raw format terminates fields safely for machine parsing.” Apply this procedure: State the contract for NUL termination protects unusual pathnames, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The binary-style stream uses NUL boundaries rather than ambiguous line breaks. For the family archive, add one near-miss that exposes splitting newline output when a valid pathname itself can contain a newline. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library catalogue. Contrast the rule using raw records explain modes, object IDs and status fields. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Combining -z with a name or raw format terminates fields safely for machine parsing.” Apply this procedure: State the contract for NUL termination protects unusual pathnames, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The binary-style stream uses NUL boundaries rather than ambiguous line breaks. For the library catalogue, add one near-miss that exposes splitting newline output when a valid pathname itself can contain a newline. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers splitting newline output when a valid pathname itself can contain a newline.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for NUL termination protects unusual pathnames, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from NUL termination protects unusual pathnames?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing splitting newline output when a valid pathname itself can contain a newline be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny science project with an automated check uses exit status without printing a patch. Include one ordinary case, one boundary and one deliberate failure caused by splitting newline output when a valid pathname itself can contain a newline. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Combining -z with a name or raw format terminates fields safely for machine parsing. It shows a trace, not only a final value. The ordinary case should demonstrate “The binary-style stream uses NUL boundaries rather than ambiguous line breaks.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for NUL termination protects unusual pathnames, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For NUL termination protects unusual pathnames, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 15 OF 20 . Debug and verify

15. Quoting settings affect non-NUL pathname display

Back to contents

Without -z, unusual characters can be quoted according to core.quotePath and related output rules. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is removing quote characters manually and corrupting path bytes. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Quoting settings affect non-NUL pathname display, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Quoting settings affect non-NUL pathname display chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on removing quote characters manually and corrupting path bytes. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git -c core.quotePath=true diff-index --name-only HEAD --

Explained result. Human-readable quoting is not a substitute for -z in reliable machine parsing. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: family archive. Transfer the rule using untracked scans are kept separate from tracked-tree comparisons. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Without -z, unusual characters can be quoted according to core.quotePath and related output rules.” Apply this procedure: State the contract for Quoting settings affect non-NUL pathname display, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Human-readable quoting is not a substitute for -z in reliable machine parsing. For the family archive, add one near-miss that exposes removing quote characters manually and corrupting path bytes. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library catalogue. Predict the rule using raw records explain modes, object IDs and status fields. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Without -z, unusual characters can be quoted according to core.quotePath and related output rules.” Apply this procedure: State the contract for Quoting settings affect non-NUL pathname display, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Human-readable quoting is not a substitute for -z in reliable machine parsing. For the library catalogue, add one near-miss that exposes removing quote characters manually and corrupting path bytes. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Contrast the rule using cached, non-cached, quiet, refresh and missing-file cases expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Without -z, unusual characters can be quoted according to core.quotePath and related output rules.” Apply this procedure: State the contract for Quoting settings affect non-NUL pathname display, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Human-readable quoting is not a substitute for -z in reliable machine parsing. For the test laboratory, add one near-miss that exposes removing quote characters manually and corrupting path bytes. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Stress-test the rule using diff-index is compared with git diff, status, write-tree and ls-files. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Without -z, unusual characters can be quoted according to core.quotePath and related output rules.” Apply this procedure: State the contract for Quoting settings affect non-NUL pathname display, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Human-readable quoting is not a substitute for -z in reliable machine parsing. For the tool decision, add one near-miss that exposes removing quote characters manually and corrupting path bytes. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers removing quote characters manually and corrupting path bytes.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Quoting settings affect non-NUL pathname display, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Quoting settings affect non-NUL pathname display?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing removing quote characters manually and corrupting path bytes be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny CCA website with renames and deletions are reported with machine-safe names. Include one ordinary case, one boundary and one deliberate failure caused by removing quote characters manually and corrupting path bytes. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Without -z, unusual characters can be quoted according to core.quotePath and related output rules. It shows a trace, not only a final value. The ordinary case should demonstrate “Human-readable quoting is not a substitute for -z in reliable machine parsing.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Quoting settings affect non-NUL pathname display, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Quoting settings affect non-NUL pathname display, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 16 OF 20 . Debug and verify

16. Index metadata can need refreshing

Back to contents

The default comparison can use cached stat information; git update-index –refresh updates index metadata for tracked paths without staging content. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is using git add merely to clear a metadata uncertainty and accidentally staging work. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Index metadata can need refreshing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Index metadata can need refreshing chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on using git add merely to clear a metadata uncertainty and accidentally staging work. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git update-index --refresh
git diff-index --quiet HEAD --

Explained result. Refresh reconciles stat information while leaving content staging decisions separate. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: test laboratory. Predict the rule using cached, non-cached, quiet, refresh and missing-file cases expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The default comparison can use cached stat information; git update-index –refresh updates index metadata for tracked paths without staging content.” Apply this procedure: State the contract for Index metadata can need refreshing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Refresh reconciles stat information while leaving content staging decisions separate. For the test laboratory, add one near-miss that exposes using git add merely to clear a metadata uncertainty and accidentally staging work. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Contrast the rule using diff-index is compared with git diff, status, write-tree and ls-files. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The default comparison can use cached stat information; git update-index –refresh updates index metadata for tracked paths without staging content.” Apply this procedure: State the contract for Index metadata can need refreshing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Refresh reconciles stat information while leaving content staging decisions separate. For the tool decision, add one near-miss that exposes using git add merely to clear a metadata uncertainty and accidentally staging work. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework repository. Stress-test the rule using a learner separates staged work from an unstaged correction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The default comparison can use cached stat information; git update-index –refresh updates index metadata for tracked paths without staging content.” Apply this procedure: State the contract for Index metadata can need refreshing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Refresh reconciles stat information while leaving content staging decisions separate. For the homework repository, add one near-miss that exposes using git add merely to clear a metadata uncertainty and accidentally staging work. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading notes. Explain the rule using one pathspec limits evidence to the current chapter folder. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The default comparison can use cached stat information; git update-index –refresh updates index metadata for tracked paths without staging content.” Apply this procedure: State the contract for Index metadata can need refreshing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Refresh reconciles stat information while leaving content staging decisions separate. For the reading notes, add one near-miss that exposes using git add merely to clear a metadata uncertainty and accidentally staging work. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers using git add merely to clear a metadata uncertainty and accidentally staging work.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Index metadata can need refreshing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Index metadata can need refreshing?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using git add merely to clear a metadata uncertainty and accidentally staging work be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny family archive with untracked scans are kept separate from tracked-tree comparisons. Include one ordinary case, one boundary and one deliberate failure caused by using git add merely to clear a metadata uncertainty and accidentally staging work. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: The default comparison can use cached stat information; git update-index –refresh updates index metadata for tracked paths without staging content. It shows a trace, not only a final value. The ordinary case should demonstrate “Refresh reconciles stat information while leaving content staging decisions separate.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Index metadata can need refreshing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Index metadata can need refreshing, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 17 OF 20 . Transfer with judgment

17. A missing working-tree file is a deletion candidate

Back to contents

When a tracked file is absent from the working tree, the default comparison can report its disappearance relative to the tree. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is assuming only edited files count as differences. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for A missing working-tree file is a deletion candidate, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the A missing working-tree file is a deletion candidate chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on assuming only edited files count as differences. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

rm notes.txt
git diff-index --name-status HEAD -- notes.txt

Explained result. The tracked path is reported as deleted in the working-tree comparison. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework repository. Contrast the rule using a learner separates staged work from an unstaged correction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “When a tracked file is absent from the working tree, the default comparison can report its disappearance relative to the tree.” Apply this procedure: State the contract for A missing working-tree file is a deletion candidate, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tracked path is reported as deleted in the working-tree comparison. For the homework repository, add one near-miss that exposes assuming only edited files count as differences. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading notes. Stress-test the rule using one pathspec limits evidence to the current chapter folder. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “When a tracked file is absent from the working tree, the default comparison can report its disappearance relative to the tree.” Apply this procedure: State the contract for A missing working-tree file is a deletion candidate, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tracked path is reported as deleted in the working-tree comparison. For the reading notes, add one near-miss that exposes assuming only edited files count as differences. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: science project. Explain the rule using an automated check uses exit status without printing a patch. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “When a tracked file is absent from the working tree, the default comparison can report its disappearance relative to the tree.” Apply this procedure: State the contract for A missing working-tree file is a deletion candidate, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tracked path is reported as deleted in the working-tree comparison. For the science project, add one near-miss that exposes assuming only edited files count as differences. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: CCA website. Transfer the rule using renames and deletions are reported with machine-safe names. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “When a tracked file is absent from the working tree, the default comparison can report its disappearance relative to the tree.” Apply this procedure: State the contract for A missing working-tree file is a deletion candidate, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The tracked path is reported as deleted in the working-tree comparison. For the CCA website, add one near-miss that exposes assuming only edited files count as differences. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers assuming only edited files count as differences.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for A missing working-tree file is a deletion candidate, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from A missing working-tree file is a deletion candidate?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming only edited files count as differences be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny library catalogue with raw records explain modes, object IDs and status fields. Include one ordinary case, one boundary and one deliberate failure caused by assuming only edited files count as differences. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: When a tracked file is absent from the working tree, the default comparison can report its disappearance relative to the tree. It shows a trace, not only a final value. The ordinary case should demonstrate “The tracked path is reported as deleted in the working-tree comparison.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for A missing working-tree file is a deletion candidate, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For A missing working-tree file is a deletion candidate, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 18 OF 20 . Transfer with judgment

18. Cached comparison corresponds to a possible tree write

Back to contents

The index compared by –cached is the state git write-tree would turn into a tree object, subject to a valid index. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is calling the index merely a list of filenames. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Cached comparison corresponds to a possible tree write, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Cached comparison corresponds to a possible tree write chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on calling the index merely a list of filenames. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git diff-index --cached --name-status HEAD --
tree=$(git write-tree); git cat-file -t "$tree"

Explained result. The comparison describes staged tree entries, and write-tree produces a tree object from them. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: science project. Stress-test the rule using an automated check uses exit status without printing a patch. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The index compared by –cached is the state git write-tree would turn into a tree object, subject to a valid index.” Apply this procedure: State the contract for Cached comparison corresponds to a possible tree write, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The comparison describes staged tree entries, and write-tree produces a tree object from them. For the science project, add one near-miss that exposes calling the index merely a list of filenames. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: CCA website. Explain the rule using renames and deletions are reported with machine-safe names. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The index compared by –cached is the state git write-tree would turn into a tree object, subject to a valid index.” Apply this procedure: State the contract for Cached comparison corresponds to a possible tree write, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The comparison describes staged tree entries, and write-tree produces a tree object from them. For the CCA website, add one near-miss that exposes calling the index merely a list of filenames. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: family archive. Transfer the rule using untracked scans are kept separate from tracked-tree comparisons. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The index compared by –cached is the state git write-tree would turn into a tree object, subject to a valid index.” Apply this procedure: State the contract for Cached comparison corresponds to a possible tree write, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The comparison describes staged tree entries, and write-tree produces a tree object from them. For the family archive, add one near-miss that exposes calling the index merely a list of filenames. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library catalogue. Predict the rule using raw records explain modes, object IDs and status fields. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The index compared by –cached is the state git write-tree would turn into a tree object, subject to a valid index.” Apply this procedure: State the contract for Cached comparison corresponds to a possible tree write, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The comparison describes staged tree entries, and write-tree produces a tree object from them. For the library catalogue, add one near-miss that exposes calling the index merely a list of filenames. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers calling the index merely a list of filenames.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Cached comparison corresponds to a possible tree write, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Cached comparison corresponds to a possible tree write?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing calling the index merely a list of filenames be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny test laboratory with cached, non-cached, quiet, refresh and missing-file cases expose boundaries. Include one ordinary case, one boundary and one deliberate failure caused by calling the index merely a list of filenames. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: The index compared by –cached is the state git write-tree would turn into a tree object, subject to a valid index. It shows a trace, not only a final value. The ordinary case should demonstrate “The comparison describes staged tree entries, and write-tree produces a tree object from them.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Cached comparison corresponds to a possible tree write, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Cached comparison corresponds to a possible tree write, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 19 OF 20 . Transfer with judgment

19. Merge-base mode changes the historical baseline

Back to contents

With –merge-base, Git can use the merge base between the commit argument and HEAD as the tree side. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is adding the option without explaining why the baseline moved. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Merge-base mode changes the historical baseline, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Merge-base mode changes the historical baseline chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on adding the option without explaining why the baseline moved. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git diff-index --merge-base main --name-only

Explained result. The comparison is based on the merge base of main and HEAD rather than simply the main tree. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: family archive. Explain the rule using untracked scans are kept separate from tracked-tree comparisons. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With –merge-base, Git can use the merge base between the commit argument and HEAD as the tree side.” Apply this procedure: State the contract for Merge-base mode changes the historical baseline, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The comparison is based on the merge base of main and HEAD rather than simply the main tree. For the family archive, add one near-miss that exposes adding the option without explaining why the baseline moved. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library catalogue. Transfer the rule using raw records explain modes, object IDs and status fields. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With –merge-base, Git can use the merge base between the commit argument and HEAD as the tree side.” Apply this procedure: State the contract for Merge-base mode changes the historical baseline, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The comparison is based on the merge base of main and HEAD rather than simply the main tree. For the library catalogue, add one near-miss that exposes adding the option without explaining why the baseline moved. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Predict the rule using cached, non-cached, quiet, refresh and missing-file cases expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With –merge-base, Git can use the merge base between the commit argument and HEAD as the tree side.” Apply this procedure: State the contract for Merge-base mode changes the historical baseline, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The comparison is based on the merge base of main and HEAD rather than simply the main tree. For the test laboratory, add one near-miss that exposes adding the option without explaining why the baseline moved. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Contrast the rule using diff-index is compared with git diff, status, write-tree and ls-files. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “With –merge-base, Git can use the merge base between the commit argument and HEAD as the tree side.” Apply this procedure: State the contract for Merge-base mode changes the historical baseline, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The comparison is based on the merge base of main and HEAD rather than simply the main tree. For the tool decision, add one near-miss that exposes adding the option without explaining why the baseline moved. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers adding the option without explaining why the baseline moved.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Merge-base mode changes the historical baseline, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Merge-base mode changes the historical baseline?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing adding the option without explaining why the baseline moved be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny tool decision with diff-index is compared with git diff, status, write-tree and ls-files. Include one ordinary case, one boundary and one deliberate failure caused by adding the option without explaining why the baseline moved. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: With –merge-base, Git can use the merge base between the commit argument and HEAD as the tree side. It shows a trace, not only a final value. The ordinary case should demonstrate “The comparison is based on the merge base of main and HEAD rather than simply the main tree.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Merge-base mode changes the historical baseline, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Merge-base mode changes the historical baseline, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 20 OF 20 . Transfer with judgment

20. Choose diff-index when explicit plumbing sides matter

Back to contents

Use diff-index for an exact tree-versus-index or tree-versus-working-state check; use git status for a human overview and porcelain git diff for common interactive reviews. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is choosing plumbing because it sounds more authoritative while leaving the compared states unnamed. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Choose diff-index when explicit plumbing sides matter, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Choose diff-index when explicit plumbing sides matter chapter on Git diff-index, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on choosing plumbing because it sounds more authoritative while leaving the compared states unnamed. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git diff-index --cached --quiet HEAD -- || echo 'staged tree differs from HEAD'

Explained result. The script states both sides and interprets the difference status, which makes the plumbing choice defensible. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: test laboratory. Transfer the rule using cached, non-cached, quiet, refresh and missing-file cases expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use diff-index for an exact tree-versus-index or tree-versus-working-state check; use git status for a human overview and porcelain git diff for common interactive reviews.” Apply this procedure: State the contract for Choose diff-index when explicit plumbing sides matter, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The script states both sides and interprets the difference status, which makes the plumbing choice defensible. For the test laboratory, add one near-miss that exposes choosing plumbing because it sounds more authoritative while leaving the compared states unnamed. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Predict the rule using diff-index is compared with git diff, status, write-tree and ls-files. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use diff-index for an exact tree-versus-index or tree-versus-working-state check; use git status for a human overview and porcelain git diff for common interactive reviews.” Apply this procedure: State the contract for Choose diff-index when explicit plumbing sides matter, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The script states both sides and interprets the difference status, which makes the plumbing choice defensible. For the tool decision, add one near-miss that exposes choosing plumbing because it sounds more authoritative while leaving the compared states unnamed. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework repository. Contrast the rule using a learner separates staged work from an unstaged correction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use diff-index for an exact tree-versus-index or tree-versus-working-state check; use git status for a human overview and porcelain git diff for common interactive reviews.” Apply this procedure: State the contract for Choose diff-index when explicit plumbing sides matter, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The script states both sides and interprets the difference status, which makes the plumbing choice defensible. For the homework repository, add one near-miss that exposes choosing plumbing because it sounds more authoritative while leaving the compared states unnamed. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading notes. Stress-test the rule using one pathspec limits evidence to the current chapter folder. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use diff-index for an exact tree-versus-index or tree-versus-working-state check; use git status for a human overview and porcelain git diff for common interactive reviews.” Apply this procedure: State the contract for Choose diff-index when explicit plumbing sides matter, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The script states both sides and interprets the difference status, which makes the plumbing choice defensible. For the reading notes, add one near-miss that exposes choosing plumbing because it sounds more authoritative while leaving the compared states unnamed. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers choosing plumbing because it sounds more authoritative while leaving the compared states unnamed.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Choose diff-index when explicit plumbing sides matter, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git diff-index syntax. For this chapter, useful prompts are: “What did you expect from Choose diff-index when explicit plumbing sides matter?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing choosing plumbing because it sounds more authoritative while leaving the compared states unnamed be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny homework repository with a learner separates staged work from an unstaged correction. Include one ordinary case, one boundary and one deliberate failure caused by choosing plumbing because it sounds more authoritative while leaving the compared states unnamed. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Use diff-index for an exact tree-versus-index or tree-versus-working-state check; use git status for a human overview and porcelain git diff for common interactive reviews. It shows a trace, not only a final value. The ordinary case should demonstrate “The script states both sides and interprets the difference status, which makes the plumbing choice defensible.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Choose diff-index when explicit plumbing sides matter, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Choose diff-index when explicit plumbing sides matter, separate the documented Git diff-index mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

Parent guide: choose the next useful step

Start with evidence, not a label such as careless. Ask for one prediction and one trace. If the first transition is wrong, rebuild the model. If the model is sound but syntax fails, practise reference use. If routine cases are correct but boundaries fail, vary ties, defaults, unsupported inputs, ownership or missing paths. If explanations transfer, move to a small project.

Keep a weekly record with four lines: concept, prediction, observed difference and next test. Stop when fatigue replaces reasoning. A smaller case tomorrow is more useful than another hour of copying tonight.

Seek specialist help when cause and effect remain invisible after examples are reduced, when accessibility or data-loss implications are unclear, or when an important repository, database or application state may be at risk. Good support should make the learner’s reasoning more independent.

Capstone practice with explained routes

1. homework repository: model, boundary and recovery

Create a small homework repository using a learner separates staged work from an unstaged correction. Combine “diff-index needs a tree side” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: The command compares a named tree-ish such as HEAD against another repository state. Apply: State the contract for diff-index needs a tree side, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: HEAD supplies the committed tree used as the left side of the comparison. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

2. reading notes: model, boundary and recovery

Create a small reading notes using one pathspec limits evidence to the current chapter folder. Combine “Staged and unstaged questions are different” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: A staged change can appear in both the cached comparison and the default tree-to-working-state view, while an unstaged-only edit is absent from –cached. Apply: State the contract for Staged and unstaged questions are different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The two outputs answer tree-versus-index and tree-versus-current-tracked-state questions respectively. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

3. science project: model, boundary and recovery

Create a small science project using an automated check uses exit status without printing a patch. Combine “Name-only output is for path discovery” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: –name-only suppresses patch detail and prints the affected pathnames. Apply: State the contract for Name-only output is for path discovery, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The output is a pathname list for changed tracked entries. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

4. CCA website: model, boundary and recovery

Create a small CCA website using renames and deletions are reported with machine-safe names. Combine “Exit-code mode distinguishes equal from different” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: –exit-code follows diff convention: zero for no differences and one when differences exist. Apply: State the contract for Exit-code mode distinguishes equal from different, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The branch uses the documented difference status without printing output. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

5. family archive: model, boundary and recovery

Create a small family archive using untracked scans are kept separate from tracked-tree comparisons. Combine “Abbreviated object names are display choices” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: –abbrev controls displayed object-name length in diff raw formats without changing repository object identity. Apply: State the contract for Abbreviated object names are display choices, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The shown IDs are shortened for output; scripts needing full identity should request or resolve full names. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

6. library catalogue: model, boundary and recovery

Create a small library catalogue using raw records explain modes, object IDs and status fields. Combine “Index metadata can need refreshing” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: The default comparison can use cached stat information; git update-index –refresh updates index metadata for tracked paths without staging content. Apply: State the contract for Index metadata can need refreshing, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: Refresh reconciles stat information while leaving content staging decisions separate. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

7. test laboratory: model, boundary and recovery

Create a small test laboratory using cached, non-cached, quiet, refresh and missing-file cases expose boundaries. Combine “Merge-base mode changes the historical baseline” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: With –merge-base, Git can use the merge base between the commit argument and HEAD as the tree side. Apply: State the contract for Merge-base mode changes the historical baseline, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The comparison is based on the merge base of main and HEAD rather than simply the main tree. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

8. tool decision: model, boundary and recovery

Create a small tool decision using diff-index is compared with git diff, status, write-tree and ls-files. Combine “Default mode considers the working tree through the index” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: Without –cached, Git uses the index plus working-tree checks to find tracked paths different from the named tree. Apply: State the contract for Default mode considers the working tree through the index, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: A tracked modified path is reported relative to HEAD. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

Frequently asked questions

How long should a practice session be?

Use one complete prediction–observation–explanation cycle while attention remains good. Ten to twenty focused minutes can be enough.

Should every option or function be memorised?

No. Memorise the governing distinctions and practise retrieving the official reference. Understanding means predicting and explaining, not reciting a parameter list.

What if the result is correct but the explanation is weak?

Treat it as partial success. Ask for a trace and change one boundary. A reliable model survives controlled variation.

Is the shortest solution the best?

Not automatically. Prefer the solution whose semantics, failure modes and maintenance cost are easiest to justify for the actual project.

When should official documentation be used?

Use it whenever syntax, supported types, SQL dialect behaviour or Git version details matter. Primary documentation settles the current contract.

How can a parent help without technical expertise?

Ask what was predicted, where the first difference appeared, what evidence matters and which smaller example could isolate it.

How do we test transfer?

Change the context, vocabulary and one boundary. Require the learner to identify the invariant before using a tool.

What should be saved after practice?

Keep the corrected rule, one trace, one boundary case and the next question. Avoid storing pages of unexplained output.

Can these exercises replace backups?

No. Use disposable examples and proper backups. Learning should not endanger schoolwork, repositories or personal data.

What counts as mastery?

The learner can predict, verify, diagnose, recover and justify a choice across more than one context, while knowing when to consult the current reference.

Official and supporting references

Return to contents

Continue from here: Start Here · Tuition · Education · Pathways · Parenting 101 · All Site Routes

eduKate Punggol

Contact

83 Punggol Central, Singapore 828761

edu|Kate Bukit Timah

8 Fourth Avenue, Singapore 268674

By Appointment +65 8823 1234
admin@edukatesg.com

Email Us

When a child finally understands, school becomes less frightening and the future opens wider. Email us for the latest schedules and fees.

← 返回

感谢您的回复。 ✨