Small Group Tutorials

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

How to Master Git read-tree in Punggol Tuition

Student in a blue pinafore smiles while seated with a notebook beside a white bag.

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 read-tree is plumbing that reads one or more tree objects into the index. With no worktree-update option it changes the index rather than materialising files; with merge modes it can prepare two-tree or three-tree index states, and with -u it can also update the worktree subject to the command’s safety rules. Mastery means naming the repository, index and worktree states separately, rehearsing in a disposable repository, and preferring porcelain for ordinary user workflows. 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. The index is the primary destination

Back to contents

Without -u, git read-tree reads tree information into the index and does not update the cached files in the worktree. 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 the command and expecting visible files to change on disk. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Record HEAD, git ls-files –stage and filesystem contents before and after.

For the The index is the primary destination chapter on Git read-tree, 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 the command and expecting visible files to change on disk. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git read-tree HEAD
git ls-files --stage

Explained result. The index is populated from HEAD while ordinary worktree files are not rewritten merely by this command. 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 committed baseline, a staged draft and an unchanged working file. 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 -u, git read-tree reads tree information into the index and does not update the cached files in the worktree.” Apply this procedure: Record HEAD, git ls-files –stage and filesystem contents before and after. The expected mechanism is: The index is populated from HEAD while ordinary worktree files are not rewritten merely by this command. For the homework repository, add one near-miss that exposes running the command and expecting visible files to change on disk. 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 two commit trees, a local edit and a temporary index. 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 -u, git read-tree reads tree information into the index and does not update the cached files in the worktree.” Apply this procedure: Record HEAD, git ls-files –stage and filesystem contents before and after. The expected mechanism is: The index is populated from HEAD while ordinary worktree files are not rewritten merely by this command. For the CCA website, add one near-miss that exposes running the command and expecting visible files to change on disk. 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 data project. Stress-test the rule using an imported tree under a prefix and collision checks. 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 -u, git read-tree reads tree information into the index and does not update the cached files in the worktree.” Apply this procedure: Record HEAD, git ls-files –stage and filesystem contents before and after. The expected mechanism is: The index is populated from HEAD while ordinary worktree files are not rewritten merely by this command. For the science data project, add one near-miss that exposes running the command and expecting visible files to change on disk. 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: revision notes. Explain the rule using an empty index, selected tree entries and a later commit. 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 -u, git read-tree reads tree information into the index and does not update the cached files in the worktree.” Apply this procedure: Record HEAD, git ls-files –stage and filesystem contents before and after. The expected mechanism is: The index is populated from HEAD while ordinary worktree files are not rewritten merely by this command. For the revision notes, add one near-miss that exposes running the command and expecting visible files to change on disk. 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 the command and expecting visible files to change on disk.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Record HEAD, git ls-files –stage and filesystem contents before and after.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from The index is the primary destination?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing running the command and expecting visible files to change on disk be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny transport map with base, current and other trees with one conflicting path. Include one ordinary case, one boundary and one deliberate failure caused by running the command and expecting visible files to change on disk. 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 -u, git read-tree reads tree information into the index and does not update the cached files in the worktree. It shows a trace, not only a final value. The ordinary case should demonstrate “The index is populated from HEAD while ordinary worktree files are not rewritten merely by this command.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Record HEAD, git ls-files –stage and filesystem contents before and after. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For The index is the primary destination, separate the documented Git read-tree 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. One tree replaces index entries

Back to contents

Reading one tree without merge or prefix mode resets the index to the entries represented by that 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 thinking the command adds entries from the tree to the existing index. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Use a disposable repository, stage a distinct change, read HEAD and compare the staged diff.

For the One tree replaces index entries chapter on Git read-tree, 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 thinking the command adds entries from the tree to the existing index. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git add report.txt
git read-tree HEAD
git diff --cached

Explained result. The staged change disappears from the index because the index now represents HEAD; the worktree edit can still remain. 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 data project. Contrast the rule using an imported tree under a prefix and collision checks. 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 “Reading one tree without merge or prefix mode resets the index to the entries represented by that tree.” Apply this procedure: Use a disposable repository, stage a distinct change, read HEAD and compare the staged diff. The expected mechanism is: The staged change disappears from the index because the index now represents HEAD; the worktree edit can still remain. For the science data project, add one near-miss that exposes thinking the command adds entries from the tree to the existing index. 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: revision notes. Stress-test the rule using an empty index, selected tree entries and a later commit. 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 “Reading one tree without merge or prefix mode resets the index to the entries represented by that tree.” Apply this procedure: Use a disposable repository, stage a distinct change, read HEAD and compare the staged diff. The expected mechanism is: The staged change disappears from the index because the index now represents HEAD; the worktree edit can still remain. For the revision notes, add one near-miss that exposes thinking the command adds entries from the tree to the existing index. 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 a worktree update, an untracked file and a backup. 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 “Reading one tree without merge or prefix mode resets the index to the entries represented by that tree.” Apply this procedure: Use a disposable repository, stage a distinct change, read HEAD and compare the staged diff. The expected mechanism is: The staged change disappears from the index because the index now represents HEAD; the worktree edit can still remain. For the family archive, add one near-miss that exposes thinking the command adds entries from the tree to the existing index. 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: transport map. Transfer the rule using base, current and other trees with one conflicting path. 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 “Reading one tree without merge or prefix mode resets the index to the entries represented by that tree.” Apply this procedure: Use a disposable repository, stage a distinct change, read HEAD and compare the staged diff. The expected mechanism is: The staged change disappears from the index because the index now represents HEAD; the worktree edit can still remain. For the transport map, add one near-miss that exposes thinking the command adds entries from the tree to the existing index. 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 thinking the command adds entries from the tree to the existing index.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Use a disposable repository, stage a distinct change, read HEAD and compare the staged diff.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from One tree replaces index entries?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing thinking the command adds entries from the tree to the existing index be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny group project with submodule entries, sparse rules and a detached submodule HEAD. Include one ordinary case, one boundary and one deliberate failure caused by thinking the command adds entries from the tree to the existing index. 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: Reading one tree without merge or prefix mode resets the index to the entries represented by that tree. It shows a trace, not only a final value. The ordinary case should demonstrate “The staged change disappears from the index because the index now represents HEAD; the worktree edit can still remain.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Use a disposable repository, stage a distinct change, read HEAD and compare the staged diff. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For One tree replaces index entries, separate the documented Git read-tree 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. Tree-ish resolution happens before reading

Back to contents

The tree argument may name a commit or another tree-ish that Git resolves to tree 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 confusing the commit object with the tree snapshot placed in the index. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Use rev-parse with the tree dereference and compare object IDs.

For the Tree-ish resolution happens before reading chapter on Git read-tree, 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 confusing the commit object with the tree snapshot placed in the index. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git rev-parse HEAD^{tree}
git read-tree HEAD

Explained result. Git resolves HEAD to its root tree and reads that snapshot into the index. 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 a worktree update, an untracked file and a backup. 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 tree argument may name a commit or another tree-ish that Git resolves to tree content.” Apply this procedure: Use rev-parse with the tree dereference and compare object IDs. The expected mechanism is: Git resolves HEAD to its root tree and reads that snapshot into the index. For the family archive, add one near-miss that exposes confusing the commit object with the tree snapshot placed in the index. 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: transport map. Explain the rule using base, current and other trees with one conflicting path. 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 tree argument may name a commit or another tree-ish that Git resolves to tree content.” Apply this procedure: Use rev-parse with the tree dereference and compare object IDs. The expected mechanism is: Git resolves HEAD to its root tree and reads that snapshot into the index. For the transport map, add one near-miss that exposes confusing the commit object with the tree snapshot placed in the index. 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: group project. Transfer the rule using submodule entries, sparse rules and a detached submodule HEAD. 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 tree argument may name a commit or another tree-ish that Git resolves to tree content.” Apply this procedure: Use rev-parse with the tree dereference and compare object IDs. The expected mechanism is: Git resolves HEAD to its root tree and reads that snapshot into the index. For the group project, add one near-miss that exposes confusing the commit object with the tree snapshot placed in the index. 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: recovery lab. Predict the rule using disposable branches, index snapshots and command transcripts. 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 tree argument may name a commit or another tree-ish that Git resolves to tree content.” Apply this procedure: Use rev-parse with the tree dereference and compare object IDs. The expected mechanism is: Git resolves HEAD to its root tree and reads that snapshot into the index. For the recovery lab, add one near-miss that exposes confusing the commit object with the tree snapshot placed in the index. 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 confusing the commit object with the tree snapshot placed in the index.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Use rev-parse with the tree dereference and compare object IDs.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from Tree-ish resolution happens before reading?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing confusing the commit object with the tree snapshot placed in the index be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny recovery lab with disposable branches, index snapshots and command transcripts. Include one ordinary case, one boundary and one deliberate failure caused by confusing the commit object with the tree snapshot placed in the index. 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 tree argument may name a commit or another tree-ish that Git resolves to tree content. It shows a trace, not only a final value. The ordinary case should demonstrate “Git resolves HEAD to its root tree and reads that snapshot into the index.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Use rev-parse with the tree dereference and compare object IDs. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Tree-ish resolution happens before reading, separate the documented Git read-tree 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. –empty clears the index

Back to contents

The –empty form reads no tree objects and leaves the index with no tracked entries. 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 it a repository deletion or assuming tracked worktree files are immediately removed. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Use a temporary index first and inspect ls-files, status and disk separately.

For the –empty clears the index chapter on Git read-tree, 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 it a repository deletion or assuming tracked worktree files are immediately removed. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

GIT_INDEX_FILE=$PWD/tmp.index git read-tree --empty
GIT_INDEX_FILE=$PWD/tmp.index git ls-files

Explained result. The temporary index contains no entries; the repository objects and ordinary worktree are not erased by that index-only operation. 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: group project. Explain the rule using submodule entries, sparse rules and a detached submodule HEAD. 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 –empty form reads no tree objects and leaves the index with no tracked entries.” Apply this procedure: Use a temporary index first and inspect ls-files, status and disk separately. The expected mechanism is: The temporary index contains no entries; the repository objects and ordinary worktree are not erased by that index-only operation. For the group project, add one near-miss that exposes calling it a repository deletion or assuming tracked worktree files are immediately removed. 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: recovery lab. Transfer the rule using disposable branches, index snapshots and command transcripts. 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 –empty form reads no tree objects and leaves the index with no tracked entries.” Apply this procedure: Use a temporary index first and inspect ls-files, status and disk separately. The expected mechanism is: The temporary index contains no entries; the repository objects and ordinary worktree are not erased by that index-only operation. For the recovery lab, add one near-miss that exposes calling it a repository deletion or assuming tracked worktree files are immediately removed. 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 committed baseline, a staged draft and an unchanged working file. 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 –empty form reads no tree objects and leaves the index with no tracked entries.” Apply this procedure: Use a temporary index first and inspect ls-files, status and disk separately. The expected mechanism is: The temporary index contains no entries; the repository objects and ordinary worktree are not erased by that index-only operation. For the homework repository, add one near-miss that exposes calling it a repository deletion or assuming tracked worktree files are immediately removed. 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 two commit trees, a local edit and a temporary index. 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 –empty form reads no tree objects and leaves the index with no tracked entries.” Apply this procedure: Use a temporary index first and inspect ls-files, status and disk separately. The expected mechanism is: The temporary index contains no entries; the repository objects and ordinary worktree are not erased by that index-only operation. For the CCA website, add one near-miss that exposes calling it a repository deletion or assuming tracked worktree files are immediately removed. 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 it a repository deletion or assuming tracked worktree files are immediately removed.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Use a temporary index first and inspect ls-files, status and disk separately.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from –empty clears the index?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing calling it a repository deletion or assuming tracked worktree files are immediately removed 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 committed baseline, a staged draft and an unchanged working file. Include one ordinary case, one boundary and one deliberate failure caused by calling it a repository deletion or assuming tracked worktree files are immediately removed. 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 –empty form reads no tree objects and leaves the index with no tracked entries. It shows a trace, not only a final value. The ordinary case should demonstrate “The temporary index contains no entries; the repository objects and ordinary worktree are not erased by that index-only operation.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Use a temporary index first and inspect ls-files, status and disk separately. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For –empty clears the index, separate the documented Git read-tree 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. A temporary index isolates experiments

Back to contents

GIT_INDEX_FILE points plumbing at another index file, allowing tree experiments without replacing the repository’s usual 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 setting a relative path carelessly or forgetting which commands inherit the environment. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Use an explicit path, label the shell and compare both indexes before deleting the temporary file.

For the A temporary index isolates experiments chapter on Git read-tree, 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 setting a relative path carelessly or forgetting which commands inherit the environment. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

export GIT_INDEX_FILE=$PWD/.git/learning.index
git read-tree HEAD
git ls-files --stage

Explained result. The alternate index receives HEAD entries while the normal index remains available when the environment variable is unset. 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 committed baseline, a staged draft and an unchanged working file. 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 “GIT_INDEX_FILE points plumbing at another index file, allowing tree experiments without replacing the repository’s usual index.” Apply this procedure: Use an explicit path, label the shell and compare both indexes before deleting the temporary file. The expected mechanism is: The alternate index receives HEAD entries while the normal index remains available when the environment variable is unset. For the homework repository, add one near-miss that exposes setting a relative path carelessly or forgetting which commands inherit the environment. 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 two commit trees, a local edit and a temporary index. 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 “GIT_INDEX_FILE points plumbing at another index file, allowing tree experiments without replacing the repository’s usual index.” Apply this procedure: Use an explicit path, label the shell and compare both indexes before deleting the temporary file. The expected mechanism is: The alternate index receives HEAD entries while the normal index remains available when the environment variable is unset. For the CCA website, add one near-miss that exposes setting a relative path carelessly or forgetting which commands inherit the environment. 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 data project. Contrast the rule using an imported tree under a prefix and collision checks. 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 “GIT_INDEX_FILE points plumbing at another index file, allowing tree experiments without replacing the repository’s usual index.” Apply this procedure: Use an explicit path, label the shell and compare both indexes before deleting the temporary file. The expected mechanism is: The alternate index receives HEAD entries while the normal index remains available when the environment variable is unset. For the science data project, add one near-miss that exposes setting a relative path carelessly or forgetting which commands inherit the environment. 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: revision notes. Stress-test the rule using an empty index, selected tree entries and a later commit. 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 “GIT_INDEX_FILE points plumbing at another index file, allowing tree experiments without replacing the repository’s usual index.” Apply this procedure: Use an explicit path, label the shell and compare both indexes before deleting the temporary file. The expected mechanism is: The alternate index receives HEAD entries while the normal index remains available when the environment variable is unset. For the revision notes, add one near-miss that exposes setting a relative path carelessly or forgetting which commands inherit the environment. 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 setting a relative path carelessly or forgetting which commands inherit the environment.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Use an explicit path, label the shell and compare both indexes before deleting the temporary file.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from A temporary index isolates experiments?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing setting a relative path carelessly or forgetting which commands inherit the environment 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 two commit trees, a local edit and a temporary index. Include one ordinary case, one boundary and one deliberate failure caused by setting a relative path carelessly or forgetting which commands inherit the environment. 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: GIT_INDEX_FILE points plumbing at another index file, allowing tree experiments without replacing the repository’s usual index. It shows a trace, not only a final value. The ordinary case should demonstrate “The alternate index receives HEAD entries while the normal index remains available when the environment variable is unset.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Use an explicit path, label the shell and compare both indexes before deleting the temporary file. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For A temporary index isolates experiments, separate the documented Git read-tree 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. –index-output writes a named result

Back to contents

The –index-output option writes the resulting index to a named file while using normal index locking constraints. 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 the output as a text listing or placing it where Git cannot atomically rename the lock result. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Write on the same filesystem with suitable directory permissions and inspect it through GIT_INDEX_FILE.

For the –index-output writes a named result chapter on Git read-tree, 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 the output as a text listing or placing it where Git cannot atomically rename the lock result. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git read-tree --index-output=$PWD/.git/result.index HEAD
GIT_INDEX_FILE=$PWD/.git/result.index git ls-files

Explained result. result.index is a binary Git index representing the requested tree, not a human-readable path list. 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 data project. Predict the rule using an imported tree under a prefix and collision checks. 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-output option writes the resulting index to a named file while using normal index locking constraints.” Apply this procedure: Write on the same filesystem with suitable directory permissions and inspect it through GIT_INDEX_FILE. The expected mechanism is: result.index is a binary Git index representing the requested tree, not a human-readable path list. For the science data project, add one near-miss that exposes treating the output as a text listing or placing it where Git cannot atomically rename the lock result. 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: revision notes. Contrast the rule using an empty index, selected tree entries and a later commit. 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-output option writes the resulting index to a named file while using normal index locking constraints.” Apply this procedure: Write on the same filesystem with suitable directory permissions and inspect it through GIT_INDEX_FILE. The expected mechanism is: result.index is a binary Git index representing the requested tree, not a human-readable path list. For the revision notes, add one near-miss that exposes treating the output as a text listing or placing it where Git cannot atomically rename the lock result. 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 a worktree update, an untracked file and a backup. 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-output option writes the resulting index to a named file while using normal index locking constraints.” Apply this procedure: Write on the same filesystem with suitable directory permissions and inspect it through GIT_INDEX_FILE. The expected mechanism is: result.index is a binary Git index representing the requested tree, not a human-readable path list. For the family archive, add one near-miss that exposes treating the output as a text listing or placing it where Git cannot atomically rename the lock result. 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: transport map. Explain the rule using base, current and other trees with one conflicting path. 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-output option writes the resulting index to a named file while using normal index locking constraints.” Apply this procedure: Write on the same filesystem with suitable directory permissions and inspect it through GIT_INDEX_FILE. The expected mechanism is: result.index is a binary Git index representing the requested tree, not a human-readable path list. For the transport map, add one near-miss that exposes treating the output as a text listing or placing it where Git cannot atomically rename the lock result. 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 the output as a text listing or placing it where Git cannot atomically rename the lock result.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Write on the same filesystem with suitable directory permissions and inspect it through GIT_INDEX_FILE.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from –index-output writes a named result?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing treating the output as a text listing or placing it where Git cannot atomically rename the lock result be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny science data project with an imported tree under a prefix and collision checks. Include one ordinary case, one boundary and one deliberate failure caused by treating the output as a text listing or placing it where Git cannot atomically rename the lock result. 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-output option writes the resulting index to a named file while using normal index locking constraints. It shows a trace, not only a final value. The ordinary case should demonstrate “result.index is a binary Git index representing the requested tree, not a human-readable path list.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Write on the same filesystem with suitable directory permissions and inspect it through GIT_INDEX_FILE. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For –index-output writes a named result, separate the documented Git read-tree 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. –prefix imports a tree below a directory

Back to contents

Prefix mode keeps current index contents and adds the named tree’s entries beneath the requested directory. 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 prefix mode to overwrite an existing indexed path at the destination. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Choose a fresh prefix, inspect the destination names and let collisions fail.

For the –prefix imports a tree below a directory chapter on Git read-tree, 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 prefix mode to overwrite an existing indexed path at the destination. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git read-tree --prefix=vendor/docs/ other^{tree}
git ls-files 'vendor/docs/*'

Explained result. Entries from the other tree appear in the index below vendor/docs while prior non-colliding entries remain. 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 a worktree update, an untracked file and a backup. 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 “Prefix mode keeps current index contents and adds the named tree’s entries beneath the requested directory.” Apply this procedure: Choose a fresh prefix, inspect the destination names and let collisions fail. The expected mechanism is: Entries from the other tree appear in the index below vendor/docs while prior non-colliding entries remain. For the family archive, add one near-miss that exposes expecting prefix mode to overwrite an existing indexed path at the destination. 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: transport map. Stress-test the rule using base, current and other trees with one conflicting path. 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 “Prefix mode keeps current index contents and adds the named tree’s entries beneath the requested directory.” Apply this procedure: Choose a fresh prefix, inspect the destination names and let collisions fail. The expected mechanism is: Entries from the other tree appear in the index below vendor/docs while prior non-colliding entries remain. For the transport map, add one near-miss that exposes expecting prefix mode to overwrite an existing indexed path at the destination. 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: group project. Explain the rule using submodule entries, sparse rules and a detached submodule HEAD. 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 “Prefix mode keeps current index contents and adds the named tree’s entries beneath the requested directory.” Apply this procedure: Choose a fresh prefix, inspect the destination names and let collisions fail. The expected mechanism is: Entries from the other tree appear in the index below vendor/docs while prior non-colliding entries remain. For the group project, add one near-miss that exposes expecting prefix mode to overwrite an existing indexed path at the destination. 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: recovery lab. Transfer the rule using disposable branches, index snapshots and command transcripts. 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 “Prefix mode keeps current index contents and adds the named tree’s entries beneath the requested directory.” Apply this procedure: Choose a fresh prefix, inspect the destination names and let collisions fail. The expected mechanism is: Entries from the other tree appear in the index below vendor/docs while prior non-colliding entries remain. For the recovery lab, add one near-miss that exposes expecting prefix mode to overwrite an existing indexed path at the destination. 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 prefix mode to overwrite an existing indexed path at the destination.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Choose a fresh prefix, inspect the destination names and let collisions fail.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from –prefix imports a tree below a directory?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing expecting prefix mode to overwrite an existing indexed path at the destination be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny revision notes with an empty index, selected tree entries and a later commit. Include one ordinary case, one boundary and one deliberate failure caused by expecting prefix mode to overwrite an existing indexed path at the destination. 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: Prefix mode keeps current index contents and adds the named tree’s entries beneath the requested directory. It shows a trace, not only a final value. The ordinary case should demonstrate “Entries from the other tree appear in the index below vendor/docs while prior non-colliding entries remain.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Choose a fresh prefix, inspect the destination names and let collisions fail. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For –prefix imports a tree below a directory, separate the documented Git read-tree 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. Prefix collisions are rejected

Back to contents

The command refuses to overwrite entries that already existed in the original index under the chosen prefix. 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 –prefix as a force-import mechanism. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Probe the destination with ls-files, choose another prefix or resolve ownership before retrying.

For the Prefix collisions are rejected chapter on Git read-tree, 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 –prefix as a force-import mechanism. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git ls-files 'vendor/docs/**'
git read-tree --prefix=vendor/docs/ other^{tree}

Explained result. If indexed paths collide, read-tree fails instead of silently replacing the existing 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: group project. Stress-test the rule using submodule entries, sparse rules and a detached submodule HEAD. 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 refuses to overwrite entries that already existed in the original index under the chosen prefix.” Apply this procedure: Probe the destination with ls-files, choose another prefix or resolve ownership before retrying. The expected mechanism is: If indexed paths collide, read-tree fails instead of silently replacing the existing entries. For the group project, add one near-miss that exposes using –prefix as a force-import mechanism. 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: recovery lab. Explain the rule using disposable branches, index snapshots and command transcripts. 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 refuses to overwrite entries that already existed in the original index under the chosen prefix.” Apply this procedure: Probe the destination with ls-files, choose another prefix or resolve ownership before retrying. The expected mechanism is: If indexed paths collide, read-tree fails instead of silently replacing the existing entries. For the recovery lab, add one near-miss that exposes using –prefix as a force-import mechanism. 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 committed baseline, a staged draft and an unchanged working file. 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 refuses to overwrite entries that already existed in the original index under the chosen prefix.” Apply this procedure: Probe the destination with ls-files, choose another prefix or resolve ownership before retrying. The expected mechanism is: If indexed paths collide, read-tree fails instead of silently replacing the existing entries. For the homework repository, add one near-miss that exposes using –prefix as a force-import mechanism. 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 two commit trees, a local edit and a temporary index. 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 refuses to overwrite entries that already existed in the original index under the chosen prefix.” Apply this procedure: Probe the destination with ls-files, choose another prefix or resolve ownership before retrying. The expected mechanism is: If indexed paths collide, read-tree fails instead of silently replacing the existing entries. For the CCA website, add one near-miss that exposes using –prefix as a force-import mechanism. 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 –prefix as a force-import mechanism.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Probe the destination with ls-files, choose another prefix or resolve ownership before retrying.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from Prefix collisions are rejected?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using –prefix as a force-import mechanism 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 a worktree update, an untracked file and a backup. Include one ordinary case, one boundary and one deliberate failure caused by using –prefix as a force-import mechanism. 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 refuses to overwrite entries that already existed in the original index under the chosen prefix. It shows a trace, not only a final value. The ordinary case should demonstrate “If indexed paths collide, read-tree fails instead of silently replacing the existing entries.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Probe the destination with ls-files, choose another prefix or resolve ownership before retrying. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Prefix collisions are rejected, separate the documented Git read-tree 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. -u crosses into the worktree

Back to contents

After a successful merge operation, -u updates worktree files to reflect the resulting index as well as changing the 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 adding -u as harmless verbosity and overlooking disk changes. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Back up work, require a clean understood state and compare index and filesystem after a dry rehearsal.

For the -u crosses into the worktree chapter on Git read-tree, 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 -u as harmless verbosity and overlooking disk changes. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git read-tree -m -u HEAD target

Explained result. A successful two-tree merge updates both the index and affected worktree paths toward target. 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 committed baseline, a staged draft and an unchanged working file. 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 “After a successful merge operation, -u updates worktree files to reflect the resulting index as well as changing the index.” Apply this procedure: Back up work, require a clean understood state and compare index and filesystem after a dry rehearsal. The expected mechanism is: A successful two-tree merge updates both the index and affected worktree paths toward target. For the homework repository, add one near-miss that exposes adding -u as harmless verbosity and overlooking disk changes. 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 two commit trees, a local edit and a temporary index. 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 “After a successful merge operation, -u updates worktree files to reflect the resulting index as well as changing the index.” Apply this procedure: Back up work, require a clean understood state and compare index and filesystem after a dry rehearsal. The expected mechanism is: A successful two-tree merge updates both the index and affected worktree paths toward target. For the CCA website, add one near-miss that exposes adding -u as harmless verbosity and overlooking disk changes. 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 data project. Predict the rule using an imported tree under a prefix and collision checks. 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 “After a successful merge operation, -u updates worktree files to reflect the resulting index as well as changing the index.” Apply this procedure: Back up work, require a clean understood state and compare index and filesystem after a dry rehearsal. The expected mechanism is: A successful two-tree merge updates both the index and affected worktree paths toward target. For the science data project, add one near-miss that exposes adding -u as harmless verbosity and overlooking disk changes. 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: revision notes. Contrast the rule using an empty index, selected tree entries and a later commit. 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 “After a successful merge operation, -u updates worktree files to reflect the resulting index as well as changing the index.” Apply this procedure: Back up work, require a clean understood state and compare index and filesystem after a dry rehearsal. The expected mechanism is: A successful two-tree merge updates both the index and affected worktree paths toward target. For the revision notes, add one near-miss that exposes adding -u as harmless verbosity and overlooking disk changes. 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 -u as harmless verbosity and overlooking disk changes.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Back up work, require a clean understood state and compare index and filesystem after a dry rehearsal.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from -u crosses into the worktree?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing adding -u as harmless verbosity and overlooking disk changes be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny transport map with base, current and other trees with one conflicting path. Include one ordinary case, one boundary and one deliberate failure caused by adding -u as harmless verbosity and overlooking disk changes. 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: After a successful merge operation, -u updates worktree files to reflect the resulting index as well as changing the index. It shows a trace, not only a final value. The ordinary case should demonstrate “A successful two-tree merge updates both the index and affected worktree paths toward target.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Back up work, require a clean understood state and compare index and filesystem after a dry rehearsal. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For -u crosses into the worktree, separate the documented Git read-tree 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. -i disables the normal worktree check

Back to contents

The -i option is intended for merges in a temporary index that are not directly related to the current worktree, and it disables the usual worktree freshness check. 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 -i on the main index to push past a safety complaint. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Pair -i with a clearly isolated GIT_INDEX_FILE and never present it as a generic force flag.

For the -i disables the normal worktree check chapter on Git read-tree, 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 -i on the main index to push past a safety complaint. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

GIT_INDEX_FILE=$PWD/.git/trial.index git read-tree -i -m base other

Explained result. The tree merge is prepared in the alternate index without requiring that it describe the current worktree. 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 data project. Transfer the rule using an imported tree under a prefix and collision checks. 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 -i option is intended for merges in a temporary index that are not directly related to the current worktree, and it disables the usual worktree freshness check.” Apply this procedure: Pair -i with a clearly isolated GIT_INDEX_FILE and never present it as a generic force flag. The expected mechanism is: The tree merge is prepared in the alternate index without requiring that it describe the current worktree. For the science data project, add one near-miss that exposes using -i on the main index to push past a safety complaint. 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: revision notes. Predict the rule using an empty index, selected tree entries and a later commit. 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 -i option is intended for merges in a temporary index that are not directly related to the current worktree, and it disables the usual worktree freshness check.” Apply this procedure: Pair -i with a clearly isolated GIT_INDEX_FILE and never present it as a generic force flag. The expected mechanism is: The tree merge is prepared in the alternate index without requiring that it describe the current worktree. For the revision notes, add one near-miss that exposes using -i on the main index to push past a safety complaint. 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 a worktree update, an untracked file and a backup. 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 -i option is intended for merges in a temporary index that are not directly related to the current worktree, and it disables the usual worktree freshness check.” Apply this procedure: Pair -i with a clearly isolated GIT_INDEX_FILE and never present it as a generic force flag. The expected mechanism is: The tree merge is prepared in the alternate index without requiring that it describe the current worktree. For the family archive, add one near-miss that exposes using -i on the main index to push past a safety complaint. 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: transport map. Stress-test the rule using base, current and other trees with one conflicting path. 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 -i option is intended for merges in a temporary index that are not directly related to the current worktree, and it disables the usual worktree freshness check.” Apply this procedure: Pair -i with a clearly isolated GIT_INDEX_FILE and never present it as a generic force flag. The expected mechanism is: The tree merge is prepared in the alternate index without requiring that it describe the current worktree. For the transport map, add one near-miss that exposes using -i on the main index to push past a safety complaint. 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 -i on the main index to push past a safety complaint.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Pair -i with a clearly isolated GIT_INDEX_FILE and never present it as a generic force flag.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from -i disables the normal worktree check?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using -i on the main index to push past a safety complaint be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny group project with submodule entries, sparse rules and a detached submodule HEAD. Include one ordinary case, one boundary and one deliberate failure caused by using -i on the main index to push past a safety complaint. 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 -i option is intended for merges in a temporary index that are not directly related to the current worktree, and it disables the usual worktree freshness check. It shows a trace, not only a final value. The ordinary case should demonstrate “The tree merge is prepared in the alternate index without requiring that it describe the current worktree.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Pair -i with a clearly isolated GIT_INDEX_FILE and never present it as a generic force flag. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For -i disables the normal worktree check, separate the documented Git read-tree 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. –dry-run tests whether an operation would error

Back to contents

The -n or –dry-run option checks whether the requested operation would fail without updating index or worktree for real. 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 successful dry run as proof that no concurrent state can change before execution. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Capture state, run the dry check and execute promptly only if the assumptions still hold.

For the –dry-run tests whether an operation would error chapter on Git read-tree, 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 successful dry run as proof that no concurrent state can change before execution. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git read-tree --dry-run -m -u HEAD target

Explained result. The command reports whether its current checks would reject the operation while leaving state unchanged. 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 a worktree update, an untracked file and a backup. 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 -n or –dry-run option checks whether the requested operation would fail without updating index or worktree for real.” Apply this procedure: Capture state, run the dry check and execute promptly only if the assumptions still hold. The expected mechanism is: The command reports whether its current checks would reject the operation while leaving state unchanged. For the family archive, add one near-miss that exposes treating a successful dry run as proof that no concurrent state can change before execution. 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: transport map. Contrast the rule using base, current and other trees with one conflicting path. 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 -n or –dry-run option checks whether the requested operation would fail without updating index or worktree for real.” Apply this procedure: Capture state, run the dry check and execute promptly only if the assumptions still hold. The expected mechanism is: The command reports whether its current checks would reject the operation while leaving state unchanged. For the transport map, add one near-miss that exposes treating a successful dry run as proof that no concurrent state can change before execution. 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: group project. Stress-test the rule using submodule entries, sparse rules and a detached submodule HEAD. 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 -n or –dry-run option checks whether the requested operation would fail without updating index or worktree for real.” Apply this procedure: Capture state, run the dry check and execute promptly only if the assumptions still hold. The expected mechanism is: The command reports whether its current checks would reject the operation while leaving state unchanged. For the group project, add one near-miss that exposes treating a successful dry run as proof that no concurrent state can change before execution. 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: recovery lab. Explain the rule using disposable branches, index snapshots and command transcripts. 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 -n or –dry-run option checks whether the requested operation would fail without updating index or worktree for real.” Apply this procedure: Capture state, run the dry check and execute promptly only if the assumptions still hold. The expected mechanism is: The command reports whether its current checks would reject the operation while leaving state unchanged. For the recovery lab, add one near-miss that exposes treating a successful dry run as proof that no concurrent state can change before execution. 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 successful dry run as proof that no concurrent state can change before execution.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Capture state, run the dry check and execute promptly only if the assumptions still hold.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from –dry-run tests whether an operation would error?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing treating a successful dry run as proof that no concurrent state can change before execution be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny recovery lab with disposable branches, index snapshots and command transcripts. Include one ordinary case, one boundary and one deliberate failure caused by treating a successful dry run as proof that no concurrent state can change before execution. 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 -n or –dry-run option checks whether the requested operation would fail without updating index or worktree for real. It shows a trace, not only a final value. The ordinary case should demonstrate “The command reports whether its current checks would reject the operation while leaving state unchanged.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Capture state, run the dry check and execute promptly only if the assumptions still hold. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For –dry-run tests whether an operation would error, separate the documented Git read-tree 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. One-tree merge preserves useful stat data

Back to contents

With -m and one tree, matching existing index entries can keep their stat information, avoiding unnecessary later worktree checks. 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 equating the one-tree merge form with a content merge between branches. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Compare entry object IDs and stat-sensitive commands rather than looking for conflict stages.

For the One-tree merge preserves useful stat data chapter on Git read-tree, 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 equating the one-tree merge form with a content merge between branches. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git read-tree -m HEAD
git diff-files --quiet

Explained result. The index still represents HEAD while reusable stat information can prevent false reports of changed worktree files. 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: group project. Contrast the rule using submodule entries, sparse rules and a detached submodule HEAD. 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 -m and one tree, matching existing index entries can keep their stat information, avoiding unnecessary later worktree checks.” Apply this procedure: Compare entry object IDs and stat-sensitive commands rather than looking for conflict stages. The expected mechanism is: The index still represents HEAD while reusable stat information can prevent false reports of changed worktree files. For the group project, add one near-miss that exposes equating the one-tree merge form with a content merge between branches. 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: recovery lab. Stress-test the rule using disposable branches, index snapshots and command transcripts. 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 -m and one tree, matching existing index entries can keep their stat information, avoiding unnecessary later worktree checks.” Apply this procedure: Compare entry object IDs and stat-sensitive commands rather than looking for conflict stages. The expected mechanism is: The index still represents HEAD while reusable stat information can prevent false reports of changed worktree files. For the recovery lab, add one near-miss that exposes equating the one-tree merge form with a content merge between branches. 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 committed baseline, a staged draft and an unchanged working file. 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 -m and one tree, matching existing index entries can keep their stat information, avoiding unnecessary later worktree checks.” Apply this procedure: Compare entry object IDs and stat-sensitive commands rather than looking for conflict stages. The expected mechanism is: The index still represents HEAD while reusable stat information can prevent false reports of changed worktree files. For the homework repository, add one near-miss that exposes equating the one-tree merge form with a content merge between branches. 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 two commit trees, a local edit and a temporary index. 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 -m and one tree, matching existing index entries can keep their stat information, avoiding unnecessary later worktree checks.” Apply this procedure: Compare entry object IDs and stat-sensitive commands rather than looking for conflict stages. The expected mechanism is: The index still represents HEAD while reusable stat information can prevent false reports of changed worktree files. For the CCA website, add one near-miss that exposes equating the one-tree merge form with a content merge between branches. 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 equating the one-tree merge form with a content merge between branches.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Compare entry object IDs and stat-sensitive commands rather than looking for conflict stages.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from One-tree merge preserves useful stat data?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing equating the one-tree merge form with a content merge between branches 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 committed baseline, a staged draft and an unchanged working file. Include one ordinary case, one boundary and one deliberate failure caused by equating the one-tree merge form with a content merge between branches. 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 -m and one tree, matching existing index entries can keep their stat information, avoiding unnecessary later worktree checks. It shows a trace, not only a final value. The ordinary case should demonstrate “The index still represents HEAD while reusable stat information can prevent false reports of changed worktree files.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Compare entry object IDs and stat-sensitive commands rather than looking for conflict stages. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For One-tree merge preserves useful stat data, separate the documented Git read-tree 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. Two-tree mode models a fast-forward transition

Back to contents

With -m and two trees, the first describes the current baseline and the second the desired later tree, while carry-forward rules protect eligible local index and worktree changes. 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 every two-tree operation a general merge solver. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Create a fast-forward history, add one controlled local change and trace H, I, M and worktree states.

For the Two-tree mode models a fast-forward transition chapter on Git read-tree, 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 every two-tree operation a general merge solver. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git read-tree -m -u HEAD next

Explained result. When safety conditions hold, entries move from HEAD toward next and eligible local state is carried or protected according to the documented rules. 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 committed baseline, a staged draft and an unchanged working file. 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 -m and two trees, the first describes the current baseline and the second the desired later tree, while carry-forward rules protect eligible local index and worktree changes.” Apply this procedure: Create a fast-forward history, add one controlled local change and trace H, I, M and worktree states. The expected mechanism is: When safety conditions hold, entries move from HEAD toward next and eligible local state is carried or protected according to the documented rules. For the homework repository, add one near-miss that exposes calling every two-tree operation a general merge solver. 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 two commit trees, a local edit and a temporary index. 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 -m and two trees, the first describes the current baseline and the second the desired later tree, while carry-forward rules protect eligible local index and worktree changes.” Apply this procedure: Create a fast-forward history, add one controlled local change and trace H, I, M and worktree states. The expected mechanism is: When safety conditions hold, entries move from HEAD toward next and eligible local state is carried or protected according to the documented rules. For the CCA website, add one near-miss that exposes calling every two-tree operation a general merge solver. 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 data project. Transfer the rule using an imported tree under a prefix and collision checks. 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 -m and two trees, the first describes the current baseline and the second the desired later tree, while carry-forward rules protect eligible local index and worktree changes.” Apply this procedure: Create a fast-forward history, add one controlled local change and trace H, I, M and worktree states. The expected mechanism is: When safety conditions hold, entries move from HEAD toward next and eligible local state is carried or protected according to the documented rules. For the science data project, add one near-miss that exposes calling every two-tree operation a general merge solver. 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: revision notes. Predict the rule using an empty index, selected tree entries and a later commit. 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 -m and two trees, the first describes the current baseline and the second the desired later tree, while carry-forward rules protect eligible local index and worktree changes.” Apply this procedure: Create a fast-forward history, add one controlled local change and trace H, I, M and worktree states. The expected mechanism is: When safety conditions hold, entries move from HEAD toward next and eligible local state is carried or protected according to the documented rules. For the revision notes, add one near-miss that exposes calling every two-tree operation a general merge solver. 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 every two-tree operation a general merge solver.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Create a fast-forward history, add one controlled local change and trace H, I, M and worktree states.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from Two-tree mode models a fast-forward transition?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing calling every two-tree operation a general merge solver 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 two commit trees, a local edit and a temporary index. Include one ordinary case, one boundary and one deliberate failure caused by calling every two-tree operation a general merge solver. 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 -m and two trees, the first describes the current baseline and the second the desired later tree, while carry-forward rules protect eligible local index and worktree changes. It shows a trace, not only a final value. The ordinary case should demonstrate “When safety conditions hold, entries move from HEAD toward next and eligible local state is carried or protected according to the documented rules.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Create a fast-forward history, add one controlled local change and trace H, I, M and worktree states. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Two-tree mode models a fast-forward transition, separate the documented Git read-tree 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. Three-tree mode records unresolved stages

Back to contents

A three-tree merge supplies base, current and other trees; paths that read-tree cannot resolve trivially remain as unmerged index stages. 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 read-tree to create a complete porcelain merge with a message and conflict markers. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Inspect git ls-files -u and design the later resolver explicitly.

For the Three-tree mode records unresolved stages chapter on Git read-tree, 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 read-tree to create a complete porcelain merge with a message and conflict markers. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git read-tree -m base ours theirs
git ls-files -u

Explained result. Conflicting paths can have stage 1, 2 and 3 entries for base, ours and theirs in the index. 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 data project. Explain the rule using an imported tree under a prefix and collision checks. 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 three-tree merge supplies base, current and other trees; paths that read-tree cannot resolve trivially remain as unmerged index stages.” Apply this procedure: Inspect git ls-files -u and design the later resolver explicitly. The expected mechanism is: Conflicting paths can have stage 1, 2 and 3 entries for base, ours and theirs in the index. For the science data project, add one near-miss that exposes expecting read-tree to create a complete porcelain merge with a message and conflict markers. 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: revision notes. Transfer the rule using an empty index, selected tree entries and a later commit. 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 three-tree merge supplies base, current and other trees; paths that read-tree cannot resolve trivially remain as unmerged index stages.” Apply this procedure: Inspect git ls-files -u and design the later resolver explicitly. The expected mechanism is: Conflicting paths can have stage 1, 2 and 3 entries for base, ours and theirs in the index. For the revision notes, add one near-miss that exposes expecting read-tree to create a complete porcelain merge with a message and conflict markers. 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 a worktree update, an untracked file and a backup. 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 three-tree merge supplies base, current and other trees; paths that read-tree cannot resolve trivially remain as unmerged index stages.” Apply this procedure: Inspect git ls-files -u and design the later resolver explicitly. The expected mechanism is: Conflicting paths can have stage 1, 2 and 3 entries for base, ours and theirs in the index. For the family archive, add one near-miss that exposes expecting read-tree to create a complete porcelain merge with a message and conflict markers. 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: transport map. Contrast the rule using base, current and other trees with one conflicting path. 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 three-tree merge supplies base, current and other trees; paths that read-tree cannot resolve trivially remain as unmerged index stages.” Apply this procedure: Inspect git ls-files -u and design the later resolver explicitly. The expected mechanism is: Conflicting paths can have stage 1, 2 and 3 entries for base, ours and theirs in the index. For the transport map, add one near-miss that exposes expecting read-tree to create a complete porcelain merge with a message and conflict markers. 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 read-tree to create a complete porcelain merge with a message and conflict markers.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Inspect git ls-files -u and design the later resolver explicitly.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from Three-tree mode records unresolved stages?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing expecting read-tree to create a complete porcelain merge with a message and conflict markers be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny science data project with an imported tree under a prefix and collision checks. Include one ordinary case, one boundary and one deliberate failure caused by expecting read-tree to create a complete porcelain merge with a message and conflict markers. 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 three-tree merge supplies base, current and other trees; paths that read-tree cannot resolve trivially remain as unmerged index stages. It shows a trace, not only a final value. The ordinary case should demonstrate “Conflicting paths can have stage 1, 2 and 3 entries for base, ours and theirs in the index.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Inspect git ls-files -u and design the later resolver explicitly. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Three-tree mode records unresolved stages, separate the documented Git read-tree 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. Unmerged entries block a new merge

Back to contents

Ordinary -m refuses to start when the index already contains unmerged entries from an unfinished operation. 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 stacking another tree merge on unresolved stages and losing the meaning of each stage. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Finish, abort through the surrounding workflow or restore a known index before trying again.

For the Unmerged entries block a new merge chapter on Git read-tree, 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 stacking another tree merge on unresolved stages and losing the meaning of each stage. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git ls-files -u
git read-tree -m base ours theirs

Explained result. If unmerged entries already exist, the new merge form fails rather than layering a second unresolved state. 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 a worktree update, an untracked file and a backup. 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 “Ordinary -m refuses to start when the index already contains unmerged entries from an unfinished operation.” Apply this procedure: Finish, abort through the surrounding workflow or restore a known index before trying again. The expected mechanism is: If unmerged entries already exist, the new merge form fails rather than layering a second unresolved state. For the family archive, add one near-miss that exposes stacking another tree merge on unresolved stages and losing the meaning of each stage. 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: transport map. Predict the rule using base, current and other trees with one conflicting path. 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 “Ordinary -m refuses to start when the index already contains unmerged entries from an unfinished operation.” Apply this procedure: Finish, abort through the surrounding workflow or restore a known index before trying again. The expected mechanism is: If unmerged entries already exist, the new merge form fails rather than layering a second unresolved state. For the transport map, add one near-miss that exposes stacking another tree merge on unresolved stages and losing the meaning of each stage. 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: group project. Contrast the rule using submodule entries, sparse rules and a detached submodule HEAD. 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 “Ordinary -m refuses to start when the index already contains unmerged entries from an unfinished operation.” Apply this procedure: Finish, abort through the surrounding workflow or restore a known index before trying again. The expected mechanism is: If unmerged entries already exist, the new merge form fails rather than layering a second unresolved state. For the group project, add one near-miss that exposes stacking another tree merge on unresolved stages and losing the meaning of each stage. 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: recovery lab. Stress-test the rule using disposable branches, index snapshots and command transcripts. 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 “Ordinary -m refuses to start when the index already contains unmerged entries from an unfinished operation.” Apply this procedure: Finish, abort through the surrounding workflow or restore a known index before trying again. The expected mechanism is: If unmerged entries already exist, the new merge form fails rather than layering a second unresolved state. For the recovery lab, add one near-miss that exposes stacking another tree merge on unresolved stages and losing the meaning of each stage. 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 stacking another tree merge on unresolved stages and losing the meaning of each stage.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Finish, abort through the surrounding workflow or restore a known index before trying again.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from Unmerged entries block a new merge?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing stacking another tree merge on unresolved stages and losing the meaning of each stage be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny revision notes with an empty index, selected tree entries and a later commit. Include one ordinary case, one boundary and one deliberate failure caused by stacking another tree merge on unresolved stages and losing the meaning of each stage. 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: Ordinary -m refuses to start when the index already contains unmerged entries from an unfinished operation. It shows a trace, not only a final value. The ordinary case should demonstrate “If unmerged entries already exist, the new merge form fails rather than layering a second unresolved state.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Finish, abort through the surrounding workflow or restore a known index before trying again. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Unmerged entries block a new merge, separate the documented Git read-tree 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. –reset discards unmerged index entries

Back to contents

The –reset form behaves like merge mode but discards existing unmerged entries instead of refusing them. 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 reset to silence an error without preserving conflict work or understanding -u consequences. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Snapshot the index and worktree, explain what will be discarded, then rehearse on a disposable branch.

For the –reset discards unmerged index entries chapter on Git read-tree, 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 reset to silence an error without preserving conflict work or understanding -u consequences. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

cp .git/index .git/index.backup
git read-tree --reset HEAD

Explained result. The index is reset to the named tree and prior unmerged stages are removed. 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: group project. Predict the rule using submodule entries, sparse rules and a detached submodule HEAD. 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 –reset form behaves like merge mode but discards existing unmerged entries instead of refusing them.” Apply this procedure: Snapshot the index and worktree, explain what will be discarded, then rehearse on a disposable branch. The expected mechanism is: The index is reset to the named tree and prior unmerged stages are removed. For the group project, add one near-miss that exposes using reset to silence an error without preserving conflict work or understanding -u consequences. 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: recovery lab. Contrast the rule using disposable branches, index snapshots and command transcripts. 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 –reset form behaves like merge mode but discards existing unmerged entries instead of refusing them.” Apply this procedure: Snapshot the index and worktree, explain what will be discarded, then rehearse on a disposable branch. The expected mechanism is: The index is reset to the named tree and prior unmerged stages are removed. For the recovery lab, add one near-miss that exposes using reset to silence an error without preserving conflict work or understanding -u consequences. 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 committed baseline, a staged draft and an unchanged working file. 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 –reset form behaves like merge mode but discards existing unmerged entries instead of refusing them.” Apply this procedure: Snapshot the index and worktree, explain what will be discarded, then rehearse on a disposable branch. The expected mechanism is: The index is reset to the named tree and prior unmerged stages are removed. For the homework repository, add one near-miss that exposes using reset to silence an error without preserving conflict work or understanding -u consequences. 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 two commit trees, a local edit and a temporary index. 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 –reset form behaves like merge mode but discards existing unmerged entries instead of refusing them.” Apply this procedure: Snapshot the index and worktree, explain what will be discarded, then rehearse on a disposable branch. The expected mechanism is: The index is reset to the named tree and prior unmerged stages are removed. For the CCA website, add one near-miss that exposes using reset to silence an error without preserving conflict work or understanding -u consequences. 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 reset to silence an error without preserving conflict work or understanding -u consequences.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Snapshot the index and worktree, explain what will be discarded, then rehearse on a disposable branch.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from –reset discards unmerged index entries?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using reset to silence an error without preserving conflict work or understanding -u consequences 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 a worktree update, an untracked file and a backup. Include one ordinary case, one boundary and one deliberate failure caused by using reset to silence an error without preserving conflict work or understanding -u consequences. 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 –reset form behaves like merge mode but discards existing unmerged entries instead of refusing them. It shows a trace, not only a final value. The ordinary case should demonstrate “The index is reset to the named tree and prior unmerged stages are removed.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Snapshot the index and worktree, explain what will be discarded, then rehearse on a disposable branch. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For –reset discards unmerged index entries, separate the documented Git read-tree 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. –trivial and –aggressive change internal resolution

Back to contents

–trivial restricts a three-tree merge to cases needing no file-level merge, while –aggressive resolves a few additional simple deletion or identical-add cases. 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 aggressive invokes a complete recursive merge strategy. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Construct one documented case at a time and inspect unresolved stages.

For the –trivial and –aggressive change internal resolution chapter on Git read-tree, 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 aggressive invokes a complete recursive merge strategy. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git read-tree -m --trivial base ours theirs

Explained result. The command succeeds only when its limited trivial rules can complete without file-level merging. 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 committed baseline, a staged draft and an unchanged working file. 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 “–trivial restricts a three-tree merge to cases needing no file-level merge, while –aggressive resolves a few additional simple deletion or identical-add cases.” Apply this procedure: Construct one documented case at a time and inspect unresolved stages. The expected mechanism is: The command succeeds only when its limited trivial rules can complete without file-level merging. For the homework repository, add one near-miss that exposes assuming aggressive invokes a complete recursive merge strategy. 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 two commit trees, a local edit and a temporary index. 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 “–trivial restricts a three-tree merge to cases needing no file-level merge, while –aggressive resolves a few additional simple deletion or identical-add cases.” Apply this procedure: Construct one documented case at a time and inspect unresolved stages. The expected mechanism is: The command succeeds only when its limited trivial rules can complete without file-level merging. For the CCA website, add one near-miss that exposes assuming aggressive invokes a complete recursive merge strategy. 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 data project. Explain the rule using an imported tree under a prefix and collision checks. 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 “–trivial restricts a three-tree merge to cases needing no file-level merge, while –aggressive resolves a few additional simple deletion or identical-add cases.” Apply this procedure: Construct one documented case at a time and inspect unresolved stages. The expected mechanism is: The command succeeds only when its limited trivial rules can complete without file-level merging. For the science data project, add one near-miss that exposes assuming aggressive invokes a complete recursive merge strategy. 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: revision notes. Transfer the rule using an empty index, selected tree entries and a later commit. 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 “–trivial restricts a three-tree merge to cases needing no file-level merge, while –aggressive resolves a few additional simple deletion or identical-add cases.” Apply this procedure: Construct one documented case at a time and inspect unresolved stages. The expected mechanism is: The command succeeds only when its limited trivial rules can complete without file-level merging. For the revision notes, add one near-miss that exposes assuming aggressive invokes a complete recursive merge strategy. 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 aggressive invokes a complete recursive merge strategy.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Construct one documented case at a time and inspect unresolved stages.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from –trivial and –aggressive change internal resolution?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming aggressive invokes a complete recursive merge strategy be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny transport map with base, current and other trees with one conflicting path. Include one ordinary case, one boundary and one deliberate failure caused by assuming aggressive invokes a complete recursive merge strategy. 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: –trivial restricts a three-tree merge to cases needing no file-level merge, while –aggressive resolves a few additional simple deletion or identical-add cases. It shows a trace, not only a final value. The ordinary case should demonstrate “The command succeeds only when its limited trivial rules can complete without file-level merging.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Construct one documented case at a time and inspect unresolved stages. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For –trivial and –aggressive change internal resolution, separate the documented Git read-tree 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. Sparse checkout can affect reading

Back to contents

read-tree normally honours sparse-checkout support when configured, while –no-sparse-checkout disables that support for this invocation. 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 mixing sparse materialisation effects with the tree-to-index result. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Record sparse configuration and index flags, then compare with an isolated –no-sparse-checkout run.

For the Sparse checkout can affect reading chapter on Git read-tree, 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 mixing sparse materialisation effects with the tree-to-index result. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git read-tree --no-sparse-checkout HEAD

Explained result. The invocation reads the tree without applying sparse-checkout support, so its index representation can differ from the sparse-aware 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: science data project. Stress-test the rule using an imported tree under a prefix and collision checks. 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 “read-tree normally honours sparse-checkout support when configured, while –no-sparse-checkout disables that support for this invocation.” Apply this procedure: Record sparse configuration and index flags, then compare with an isolated –no-sparse-checkout run. The expected mechanism is: The invocation reads the tree without applying sparse-checkout support, so its index representation can differ from the sparse-aware path. For the science data project, add one near-miss that exposes mixing sparse materialisation effects with the tree-to-index result. 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: revision notes. Explain the rule using an empty index, selected tree entries and a later commit. 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 “read-tree normally honours sparse-checkout support when configured, while –no-sparse-checkout disables that support for this invocation.” Apply this procedure: Record sparse configuration and index flags, then compare with an isolated –no-sparse-checkout run. The expected mechanism is: The invocation reads the tree without applying sparse-checkout support, so its index representation can differ from the sparse-aware path. For the revision notes, add one near-miss that exposes mixing sparse materialisation effects with the tree-to-index result. 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 a worktree update, an untracked file and a backup. 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 “read-tree normally honours sparse-checkout support when configured, while –no-sparse-checkout disables that support for this invocation.” Apply this procedure: Record sparse configuration and index flags, then compare with an isolated –no-sparse-checkout run. The expected mechanism is: The invocation reads the tree without applying sparse-checkout support, so its index representation can differ from the sparse-aware path. For the family archive, add one near-miss that exposes mixing sparse materialisation effects with the tree-to-index result. 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: transport map. Predict the rule using base, current and other trees with one conflicting path. 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 “read-tree normally honours sparse-checkout support when configured, while –no-sparse-checkout disables that support for this invocation.” Apply this procedure: Record sparse configuration and index flags, then compare with an isolated –no-sparse-checkout run. The expected mechanism is: The invocation reads the tree without applying sparse-checkout support, so its index representation can differ from the sparse-aware path. For the transport map, add one near-miss that exposes mixing sparse materialisation effects with the tree-to-index result. 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 mixing sparse materialisation effects with the tree-to-index result.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Record sparse configuration and index flags, then compare with an isolated –no-sparse-checkout run.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from Sparse checkout can affect reading?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing mixing sparse materialisation effects with the tree-to-index result be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny group project with submodule entries, sparse rules and a detached submodule HEAD. Include one ordinary case, one boundary and one deliberate failure caused by mixing sparse materialisation effects with the tree-to-index result. 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: read-tree normally honours sparse-checkout support when configured, while –no-sparse-checkout disables that support for this invocation. It shows a trace, not only a final value. The ordinary case should demonstrate “The invocation reads the tree without applying sparse-checkout support, so its index representation can differ from the sparse-aware path.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Record sparse configuration and index flags, then compare with an isolated –no-sparse-checkout run. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Sparse checkout can affect reading, separate the documented Git read-tree 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. Recursive submodule updates are stateful

Back to contents

With –recurse-submodules, active submodules are updated to commits recorded by the superproject and their HEADs are detached at those commits. 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 gitlink entry as an ordinary directory copy or overlooking nested worktree changes. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Inspect submodule status, preserve local submodule work and rehearse with disposable clones.

For the Recursive submodule updates are stateful chapter on Git read-tree, 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 gitlink entry as an ordinary directory copy or overlooking nested worktree changes. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git read-tree --recurse-submodules -m -u HEAD target

Explained result. Active submodule worktrees can move to recorded commits with detached HEADs as part of the update. 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 a worktree update, an untracked file and a backup. 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 –recurse-submodules, active submodules are updated to commits recorded by the superproject and their HEADs are detached at those commits.” Apply this procedure: Inspect submodule status, preserve local submodule work and rehearse with disposable clones. The expected mechanism is: Active submodule worktrees can move to recorded commits with detached HEADs as part of the update. For the family archive, add one near-miss that exposes treating a gitlink entry as an ordinary directory copy or overlooking nested worktree changes. 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: transport map. Transfer the rule using base, current and other trees with one conflicting path. 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 –recurse-submodules, active submodules are updated to commits recorded by the superproject and their HEADs are detached at those commits.” Apply this procedure: Inspect submodule status, preserve local submodule work and rehearse with disposable clones. The expected mechanism is: Active submodule worktrees can move to recorded commits with detached HEADs as part of the update. For the transport map, add one near-miss that exposes treating a gitlink entry as an ordinary directory copy or overlooking nested worktree changes. 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: group project. Predict the rule using submodule entries, sparse rules and a detached submodule HEAD. 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 –recurse-submodules, active submodules are updated to commits recorded by the superproject and their HEADs are detached at those commits.” Apply this procedure: Inspect submodule status, preserve local submodule work and rehearse with disposable clones. The expected mechanism is: Active submodule worktrees can move to recorded commits with detached HEADs as part of the update. For the group project, add one near-miss that exposes treating a gitlink entry as an ordinary directory copy or overlooking nested worktree changes. 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: recovery lab. Contrast the rule using disposable branches, index snapshots and command transcripts. 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 –recurse-submodules, active submodules are updated to commits recorded by the superproject and their HEADs are detached at those commits.” Apply this procedure: Inspect submodule status, preserve local submodule work and rehearse with disposable clones. The expected mechanism is: Active submodule worktrees can move to recorded commits with detached HEADs as part of the update. For the recovery lab, add one near-miss that exposes treating a gitlink entry as an ordinary directory copy or overlooking nested worktree changes. 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 gitlink entry as an ordinary directory copy or overlooking nested worktree changes.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Inspect submodule status, preserve local submodule work and rehearse with disposable clones.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from Recursive submodule updates are stateful?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing treating a gitlink entry as an ordinary directory copy or overlooking nested worktree changes be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny recovery lab with disposable branches, index snapshots and command transcripts. Include one ordinary case, one boundary and one deliberate failure caused by treating a gitlink entry as an ordinary directory copy or overlooking nested worktree changes. 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 –recurse-submodules, active submodules are updated to commits recorded by the superproject and their HEADs are detached at those commits. It shows a trace, not only a final value. The ordinary case should demonstrate “Active submodule worktrees can move to recorded commits with detached HEADs as part of the update.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Inspect submodule status, preserve local submodule work and rehearse with disposable clones. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Recursive submodule updates are stateful, separate the documented Git read-tree 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. Use porcelain for ordinary workflows

Back to contents

read-tree is plumbing for carefully designed index operations; switch, checkout, restore, merge and sparse-checkout usually state everyday user intent more clearly. 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 teaching a low-level command as a shortcut without exposing its index and worktree effects. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Name the user job first, choose the porcelain when it owns that job and reserve read-tree for an explained plumbing requirement.

For the Use porcelain for ordinary workflows chapter on Git read-tree, 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 teaching a low-level command as a shortcut without exposing its index and worktree effects. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git switch topic

Explained result. For normal branch movement, switch communicates the intended workflow and coordinates more surrounding policy than a hand-built read-tree sequence. 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: group project. Transfer the rule using submodule entries, sparse rules and a detached submodule HEAD. 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 “read-tree is plumbing for carefully designed index operations; switch, checkout, restore, merge and sparse-checkout usually state everyday user intent more clearly.” Apply this procedure: Name the user job first, choose the porcelain when it owns that job and reserve read-tree for an explained plumbing requirement. The expected mechanism is: For normal branch movement, switch communicates the intended workflow and coordinates more surrounding policy than a hand-built read-tree sequence. For the group project, add one near-miss that exposes teaching a low-level command as a shortcut without exposing its index and worktree effects. 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: recovery lab. Predict the rule using disposable branches, index snapshots and command transcripts. 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 “read-tree is plumbing for carefully designed index operations; switch, checkout, restore, merge and sparse-checkout usually state everyday user intent more clearly.” Apply this procedure: Name the user job first, choose the porcelain when it owns that job and reserve read-tree for an explained plumbing requirement. The expected mechanism is: For normal branch movement, switch communicates the intended workflow and coordinates more surrounding policy than a hand-built read-tree sequence. For the recovery lab, add one near-miss that exposes teaching a low-level command as a shortcut without exposing its index and worktree effects. 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 committed baseline, a staged draft and an unchanged working file. 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 “read-tree is plumbing for carefully designed index operations; switch, checkout, restore, merge and sparse-checkout usually state everyday user intent more clearly.” Apply this procedure: Name the user job first, choose the porcelain when it owns that job and reserve read-tree for an explained plumbing requirement. The expected mechanism is: For normal branch movement, switch communicates the intended workflow and coordinates more surrounding policy than a hand-built read-tree sequence. For the homework repository, add one near-miss that exposes teaching a low-level command as a shortcut without exposing its index and worktree effects. 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 two commit trees, a local edit and a temporary index. 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 “read-tree is plumbing for carefully designed index operations; switch, checkout, restore, merge and sparse-checkout usually state everyday user intent more clearly.” Apply this procedure: Name the user job first, choose the porcelain when it owns that job and reserve read-tree for an explained plumbing requirement. The expected mechanism is: For normal branch movement, switch communicates the intended workflow and coordinates more surrounding policy than a hand-built read-tree sequence. For the CCA website, add one near-miss that exposes teaching a low-level command as a shortcut without exposing its index and worktree effects. 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 teaching a low-level command as a shortcut without exposing its index and worktree effects.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Name the user job first, choose the porcelain when it owns that job and reserve read-tree for an explained plumbing requirement.” 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 read-tree syntax. For this chapter, useful prompts are: “What did you expect from Use porcelain for ordinary workflows?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing teaching a low-level command as a shortcut without exposing its index and worktree effects 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 committed baseline, a staged draft and an unchanged working file. Include one ordinary case, one boundary and one deliberate failure caused by teaching a low-level command as a shortcut without exposing its index and worktree effects. 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: read-tree is plumbing for carefully designed index operations; switch, checkout, restore, merge and sparse-checkout usually state everyday user intent more clearly. It shows a trace, not only a final value. The ordinary case should demonstrate “For normal branch movement, switch communicates the intended workflow and coordinates more surrounding policy than a hand-built read-tree sequence.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Name the user job first, choose the porcelain when it owns that job and reserve read-tree for an explained plumbing requirement. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Use porcelain for ordinary workflows, separate the documented Git read-tree 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 committed baseline, a staged draft and an unchanged working file. Combine “The index is the primary destination” 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 -u, git read-tree reads tree information into the index and does not update the cached files in the worktree. Apply: Record HEAD, git ls-files –stage and filesystem contents before and after. Verify: The index is populated from HEAD while ordinary worktree files are not rewritten merely by this command. 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. CCA website: model, boundary and recovery

Create a small CCA website using two commit trees, a local edit and a temporary index. Combine “–empty clears 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: The –empty form reads no tree objects and leaves the index with no tracked entries. Apply: Use a temporary index first and inspect ls-files, status and disk separately. Verify: The temporary index contains no entries; the repository objects and ordinary worktree are not erased by that index-only operation. 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 data project: model, boundary and recovery

Create a small science data project using an imported tree under a prefix and collision checks. Combine “–prefix imports a tree below a directory” 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: Prefix mode keeps current index contents and adds the named tree’s entries beneath the requested directory. Apply: Choose a fresh prefix, inspect the destination names and let collisions fail. Verify: Entries from the other tree appear in the index below vendor/docs while prior non-colliding entries remain. 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. revision notes: model, boundary and recovery

Create a small revision notes using an empty index, selected tree entries and a later commit. Combine “-i disables the normal worktree check” 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 -i option is intended for merges in a temporary index that are not directly related to the current worktree, and it disables the usual worktree freshness check. Apply: Pair -i with a clearly isolated GIT_INDEX_FILE and never present it as a generic force flag. Verify: The tree merge is prepared in the alternate index without requiring that it describe the current worktree. 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 a worktree update, an untracked file and a backup. Combine “Two-tree mode models a fast-forward transition” 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 -m and two trees, the first describes the current baseline and the second the desired later tree, while carry-forward rules protect eligible local index and worktree changes. Apply: Create a fast-forward history, add one controlled local change and trace H, I, M and worktree states. Verify: When safety conditions hold, entries move from HEAD toward next and eligible local state is carried or protected according to the documented rules. 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. transport map: model, boundary and recovery

Create a small transport map using base, current and other trees with one conflicting path. Combine “–reset discards unmerged index entries” 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 –reset form behaves like merge mode but discards existing unmerged entries instead of refusing them. Apply: Snapshot the index and worktree, explain what will be discarded, then rehearse on a disposable branch. Verify: The index is reset to the named tree and prior unmerged stages are removed. 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. group project: model, boundary and recovery

Create a small group project using submodule entries, sparse rules and a detached submodule HEAD. Combine “Recursive submodule updates are stateful” 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 –recurse-submodules, active submodules are updated to commits recorded by the superproject and their HEADs are detached at those commits. Apply: Inspect submodule status, preserve local submodule work and rehearse with disposable clones. Verify: Active submodule worktrees can move to recorded commits with detached HEADs as part of the update. 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. recovery lab: model, boundary and recovery

Create a small recovery lab using disposable branches, index snapshots and command transcripts. Combine “One tree replaces index entries” 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: Reading one tree without merge or prefix mode resets the index to the entries represented by that tree. Apply: Use a disposable repository, stage a distinct change, read HEAD and compare the staged diff. Verify: The staged change disappears from the index because the index now represents HEAD; the worktree edit can still remain. 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.

← 返回

感谢您的回复。 ✨

了解 eduKate Punggol 的更多信息

立即订阅以继续阅读并访问完整档案。

继续阅读