Small Group Tutorials

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

How to Master Git update-ref in Punggol Tuition

Waterway Point Running Park Water Feature Canal with trees

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 update-ref is plumbing for changing references while respecting ref locking, optional old-value verification and reflog policy. It is not merely a faster way to overwrite a file under .git. Mastery means naming the full ref, resolving the intended new object, using an expected old object for compare-and-swap safety, distinguishing dereferenced symbolic-ref updates from –no-deref changes, understanding that stdin commands can be grouped into explicit transactions, recording a meaningful reflog message, and proving both success and rejection in a disposable repository before automating important ref changes. 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. Two-argument update moves a ref

Back to contents

git update-ref resolves the new object name and safely updates the named reference. 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 editing a loose ref file and ignoring packed refs, locks and validation. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Two-argument update moves a ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Two-argument update moves a ref chapter on Git update-ref, 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 editing a loose ref file and ignoring packed refs, locks and validation. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new=$(git rev-parse HEAD)
git update-ref refs/heads/practice "$new"

Explained result. refs/heads/practice points at the resolved HEAD object after Git completes the locked 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: revision repository. Predict the rule using a practice branch moves only from the expected old 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 update-ref resolves the new object name and safely updates the named reference.” Apply this procedure: State the contract for Two-argument update moves a ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: refs/heads/practice points at the resolved HEAD object after Git completes the locked update. For the revision repository, add one near-miss that exposes editing a loose ref file and ignoring packed refs, locks and validation. 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: science report. Contrast the rule using a publish ref is created only when absent. 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 update-ref resolves the new object name and safely updates the named reference.” Apply this procedure: State the contract for Two-argument update moves a ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: refs/heads/practice points at the resolved HEAD object after Git completes the locked update. For the science report, add one near-miss that exposes editing a loose ref file and ignoring packed refs, locks and validation. 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: CCA project. Stress-test the rule using a stale process loses a compare-and-swap race safely. 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 update-ref resolves the new object name and safely updates the named reference.” Apply this procedure: State the contract for Two-argument update moves a ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: refs/heads/practice points at the resolved HEAD object after Git completes the locked update. For the CCA project, add one near-miss that exposes editing a loose ref file and ignoring packed refs, locks and validation. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading notes. Explain the rule using a temporary ref is deleted only from the expected value. 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 update-ref resolves the new object name and safely updates the named reference.” Apply this procedure: State the contract for Two-argument update moves a ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: refs/heads/practice points at the resolved HEAD object after Git completes the locked update. For the reading notes, add one near-miss that exposes editing a loose ref file and ignoring packed refs, locks and validation. 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 editing a loose ref file and ignoring packed refs, locks and validation.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Two-argument update moves a ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from Two-argument update moves a ref?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing editing a loose ref file and ignoring packed refs, locks and validation be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny recovery drill with reflog messages explain an intentional repair. Include one ordinary case, one boundary and one deliberate failure caused by editing a loose ref file and ignoring packed refs, locks and validation. 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 update-ref resolves the new object name and safely updates the named reference. It shows a trace, not only a final value. The ordinary case should demonstrate “refs/heads/practice points at the resolved HEAD object after Git completes the locked update.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Two-argument update moves a ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Two-argument update moves a ref, separate the documented Git update-ref 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. An expected old object adds compare-and-swap safety

Back to contents

Providing old-oid requires the ref’s current value to match before it is changed. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is reading a ref and later overwriting a concurrent update without verifying the old value. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for An expected old object adds compare-and-swap safety, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the An expected old object adds compare-and-swap safety chapter on Git update-ref, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on reading a ref and later overwriting a concurrent update without verifying the old value. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

old=$(git rev-parse refs/heads/practice)
new=$(git rev-parse HEAD)
git update-ref refs/heads/practice "$new" "$old"

Explained result. The move succeeds only if practice still equals old when the lock is checked. 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: CCA project. Contrast the rule using a stale process loses a compare-and-swap race safely. 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 “Providing old-oid requires the ref’s current value to match before it is changed.” Apply this procedure: State the contract for An expected old object adds compare-and-swap safety, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The move succeeds only if practice still equals old when the lock is checked. For the CCA project, add one near-miss that exposes reading a ref and later overwriting a concurrent update without verifying the old value. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading notes. Stress-test the rule using a temporary ref is deleted only from the expected value. 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 “Providing old-oid requires the ref’s current value to match before it is changed.” Apply this procedure: State the contract for An expected old object adds compare-and-swap safety, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The move succeeds only if practice still equals old when the lock is checked. For the reading notes, add one near-miss that exposes reading a ref and later overwriting a concurrent update without verifying the old value. 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: release rehearsal. Explain the rule using several refs prepare and commit as one transaction. 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 “Providing old-oid requires the ref’s current value to match before it is changed.” Apply this procedure: State the contract for An expected old object adds compare-and-swap safety, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The move succeeds only if practice still equals old when the lock is checked. For the release rehearsal, add one near-miss that exposes reading a ref and later overwriting a concurrent update without verifying the old value. 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 drill. Transfer the rule using reflog messages explain an intentional repair. 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 “Providing old-oid requires the ref’s current value to match before it is changed.” Apply this procedure: State the contract for An expected old object adds compare-and-swap safety, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The move succeeds only if practice still equals old when the lock is checked. For the recovery drill, add one near-miss that exposes reading a ref and later overwriting a concurrent update without verifying the old value. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers reading a ref and later overwriting a concurrent update without verifying the old value.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for An expected old object adds compare-and-swap safety, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from An expected old object adds compare-and-swap safety?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing reading a ref and later overwriting a concurrent update without verifying the old value be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny test laboratory with missing refs, symbolic refs, wrong old IDs and lock failures expose boundaries. Include one ordinary case, one boundary and one deliberate failure caused by reading a ref and later overwriting a concurrent update without verifying the old value. 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: Providing old-oid requires the ref’s current value to match before it is changed. It shows a trace, not only a final value. The ordinary case should demonstrate “The move succeeds only if practice still equals old when the lock is checked.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for An expected old object adds compare-and-swap safety, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For An expected old object adds compare-and-swap safety, separate the documented Git update-ref 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. A zero old object means create only if absent

Back to contents

An all-zero old object ID, or the permitted empty old value, asserts that the ref must not already exist. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is creating with no precondition and silently replacing an owner that appeared concurrently. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for A zero old object means create only if absent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the A zero old object means create only if absent chapter on Git update-ref, 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 creating with no precondition and silently replacing an owner that appeared concurrently. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

zero=$(git hash-object --stdin </dev/null | sed 's/./0/g')
git update-ref refs/heads/new-topic HEAD "$zero"

Explained result. The operation creates new-topic only when no current ref value exists. 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: release rehearsal. Stress-test the rule using several refs prepare and commit as one transaction. 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 “An all-zero old object ID, or the permitted empty old value, asserts that the ref must not already exist.” Apply this procedure: State the contract for A zero old object means create only if absent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The operation creates new-topic only when no current ref value exists. For the release rehearsal, add one near-miss that exposes creating with no precondition and silently replacing an owner that appeared concurrently. 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 drill. Explain the rule using reflog messages explain an intentional repair. 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 “An all-zero old object ID, or the permitted empty old value, asserts that the ref must not already exist.” Apply this procedure: State the contract for A zero old object means create only if absent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The operation creates new-topic only when no current ref value exists. For the recovery drill, add one near-miss that exposes creating with no precondition and silently replacing an owner that appeared concurrently. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Transfer the rule using missing refs, symbolic refs, wrong old IDs and lock failures expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An all-zero old object ID, or the permitted empty old value, asserts that the ref must not already exist.” Apply this procedure: State the contract for A zero old object means create only if absent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The operation creates new-topic only when no current ref value exists. For the test laboratory, add one near-miss that exposes creating with no precondition and silently replacing an owner that appeared concurrently. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Predict the rule using update-ref is compared with branch, reset, tag and symbolic-ref porcelain. 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 “An all-zero old object ID, or the permitted empty old value, asserts that the ref must not already exist.” Apply this procedure: State the contract for A zero old object means create only if absent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The operation creates new-topic only when no current ref value exists. For the tool decision, add one near-miss that exposes creating with no precondition and silently replacing an owner that appeared concurrently. 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 creating with no precondition and silently replacing an owner that appeared concurrently.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for A zero old object means create only if absent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from A zero old object means create only if absent?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing creating with no precondition and silently replacing an owner that appeared concurrently be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny tool decision with update-ref is compared with branch, reset, tag and symbolic-ref porcelain. Include one ordinary case, one boundary and one deliberate failure caused by creating with no precondition and silently replacing an owner that appeared concurrently. 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: An all-zero old object ID, or the permitted empty old value, asserts that the ref must not already exist. It shows a trace, not only a final value. The ordinary case should demonstrate “The operation creates new-topic only when no current ref value exists.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for A zero old object means create only if absent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For A zero old object means create only if absent, separate the documented Git update-ref 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. A wrong old object rejects without moving the ref

Back to contents

When the expected old value differs, update-ref fails and leaves the current reference unchanged. 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 rejection as a reason to repeat without rereading ownership. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for A wrong old object rejects without moving the ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the A wrong old object rejects without moving the ref chapter on Git update-ref, 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 rejection as a reason to repeat without rereading ownership. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

actual=$(git rev-parse refs/heads/practice)
git update-ref refs/heads/practice HEAD HEAD^ || echo rejected
test "$(git rev-parse refs/heads/practice)" = "$actual"

Explained result. The stale comparison is rejected and the equality check confirms no move. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: test laboratory. Explain the rule using missing refs, symbolic refs, wrong old IDs and lock failures expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “When the expected old value differs, update-ref fails and leaves the current reference unchanged.” Apply this procedure: State the contract for A wrong old object rejects without moving the ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The stale comparison is rejected and the equality check confirms no move. For the test laboratory, add one near-miss that exposes treating rejection as a reason to repeat without rereading ownership. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Transfer the rule using update-ref is compared with branch, reset, tag and symbolic-ref porcelain. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “When the expected old value differs, update-ref fails and leaves the current reference unchanged.” Apply this procedure: State the contract for A wrong old object rejects without moving the ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The stale comparison is rejected and the equality check confirms no move. For the tool decision, add one near-miss that exposes treating rejection as a reason to repeat without rereading ownership. 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: revision repository. Predict the rule using a practice branch moves only from the expected old 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 “When the expected old value differs, update-ref fails and leaves the current reference unchanged.” Apply this procedure: State the contract for A wrong old object rejects without moving the ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The stale comparison is rejected and the equality check confirms no move. For the revision repository, add one near-miss that exposes treating rejection as a reason to repeat without rereading ownership. 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: science report. Contrast the rule using a publish ref is created only when absent. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “When the expected old value differs, update-ref fails and leaves the current reference unchanged.” Apply this procedure: State the contract for A wrong old object rejects without moving the ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The stale comparison is rejected and the equality check confirms no move. For the science report, add one near-miss that exposes treating rejection as a reason to repeat without rereading ownership. 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 rejection as a reason to repeat without rereading ownership.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for A wrong old object rejects without moving the ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from A wrong old object rejects without moving the ref?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing treating rejection as a reason to repeat without rereading ownership be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny revision repository with a practice branch moves only from the expected old commit. Include one ordinary case, one boundary and one deliberate failure caused by treating rejection as a reason to repeat without rereading ownership. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: When the expected old value differs, update-ref fails and leaves the current reference unchanged. It shows a trace, not only a final value. The ordinary case should demonstrate “The stale comparison is rejected and the equality check confirms no move.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for A wrong old object rejects without moving the ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For A wrong old object rejects without moving the ref, separate the documented Git update-ref 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. Delete with -d can verify the old value

Back to contents

git update-ref -d [old-oid] removes the ref, optionally only when its current value matches. 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 deleting a ref name whose owner changed after the decision was made. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Delete with -d can verify the old value, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Delete with -d can verify the old value chapter on Git update-ref, 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 deleting a ref name whose owner changed after the decision was made. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

old=$(git rev-parse refs/heads/temp)
git update-ref -d refs/heads/temp "$old"

Explained result. temp is deleted only if it still points at old. 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: revision repository. Transfer the rule using a practice branch moves only from the expected old 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 update-ref -d [old-oid] removes the ref, optionally only when its current value matches.” Apply this procedure: State the contract for Delete with -d can verify the old value, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: temp is deleted only if it still points at old. For the revision repository, add one near-miss that exposes deleting a ref name whose owner changed after the decision was made. 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: science report. Predict the rule using a publish ref is created only when absent. 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 update-ref -d [old-oid] removes the ref, optionally only when its current value matches.” Apply this procedure: State the contract for Delete with -d can verify the old value, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: temp is deleted only if it still points at old. For the science report, add one near-miss that exposes deleting a ref name whose owner changed after the decision was made. 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: CCA project. Contrast the rule using a stale process loses a compare-and-swap race safely. 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 update-ref -d [old-oid] removes the ref, optionally only when its current value matches.” Apply this procedure: State the contract for Delete with -d can verify the old value, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: temp is deleted only if it still points at old. For the CCA project, add one near-miss that exposes deleting a ref name whose owner changed after the decision was made. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading notes. Stress-test the rule using a temporary ref is deleted only from the expected value. 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 update-ref -d [old-oid] removes the ref, optionally only when its current value matches.” Apply this procedure: State the contract for Delete with -d can verify the old value, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: temp is deleted only if it still points at old. For the reading notes, add one near-miss that exposes deleting a ref name whose owner changed after the decision was made. 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 deleting a ref name whose owner changed after the decision was made.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Delete with -d can verify the old value, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from Delete with -d can verify the old value?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing deleting a ref name whose owner changed after the decision was made be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny science report with a publish ref is created only when absent. Include one ordinary case, one boundary and one deliberate failure caused by deleting a ref name whose owner changed after the decision was made. 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 update-ref -d [old-oid] removes the ref, optionally only when its current value matches. It shows a trace, not only a final value. The ordinary case should demonstrate “temp is deleted only if it still points at old.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Delete with -d can verify the old value, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Delete with -d can verify the old value, separate the documented Git update-ref 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. Use full valid reference names

Back to contents

Reference creation is subject to Git refname rules; a full refs/heads or refs/tags name makes namespace intent explicit. 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 passing an ambiguous short word and assuming every plumbing command expands it like porcelain. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Use full valid reference names, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Use full valid reference names chapter on Git update-ref, 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 passing an ambiguous short word and assuming every plumbing command expands it like porcelain. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git check-ref-format refs/heads/review/topic && git update-ref refs/heads/review/topic HEAD

Explained result. The format check and full name state exactly which ref is created. 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: CCA project. Predict the rule using a stale process loses a compare-and-swap race safely. 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 “Reference creation is subject to Git refname rules; a full refs/heads or refs/tags name makes namespace intent explicit.” Apply this procedure: State the contract for Use full valid reference names, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The format check and full name state exactly which ref is created. For the CCA project, add one near-miss that exposes passing an ambiguous short word and assuming every plumbing command expands it like porcelain. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading notes. Contrast the rule using a temporary ref is deleted only from the expected value. 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 “Reference creation is subject to Git refname rules; a full refs/heads or refs/tags name makes namespace intent explicit.” Apply this procedure: State the contract for Use full valid reference names, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The format check and full name state exactly which ref is created. For the reading notes, add one near-miss that exposes passing an ambiguous short word and assuming every plumbing command expands it like porcelain. 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: release rehearsal. Stress-test the rule using several refs prepare and commit as one transaction. 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 “Reference creation is subject to Git refname rules; a full refs/heads or refs/tags name makes namespace intent explicit.” Apply this procedure: State the contract for Use full valid reference names, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The format check and full name state exactly which ref is created. For the release rehearsal, add one near-miss that exposes passing an ambiguous short word and assuming every plumbing command expands it like porcelain. 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 drill. Explain the rule using reflog messages explain an intentional repair. 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 “Reference creation is subject to Git refname rules; a full refs/heads or refs/tags name makes namespace intent explicit.” Apply this procedure: State the contract for Use full valid reference names, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The format check and full name state exactly which ref is created. For the recovery drill, add one near-miss that exposes passing an ambiguous short word and assuming every plumbing command expands it like porcelain. 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 passing an ambiguous short word and assuming every plumbing command expands it like porcelain.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Use full valid reference names, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from Use full valid reference names?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing passing an ambiguous short word and assuming every plumbing command expands it like porcelain be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny CCA project with a stale process loses a compare-and-swap race safely. Include one ordinary case, one boundary and one deliberate failure caused by passing an ambiguous short word and assuming every plumbing command expands it like porcelain. 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: Reference creation is subject to Git refname rules; a full refs/heads or refs/tags name makes namespace intent explicit. It shows a trace, not only a final value. The ordinary case should demonstrate “The format check and full name state exactly which ref is created.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Use full valid reference names, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Use full valid reference names, separate the documented Git update-ref 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. Object expressions are resolved before storage

Back to contents

new-oid and old-oid arguments can be resolvable object names, while the ref ultimately stores an object ID appropriate to its use. 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 recording the text HEAD~2 as though a ref file keeps that expression dynamically. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Object expressions are resolved before storage, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Object expressions are resolved before storage chapter on Git update-ref, 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 recording the text HEAD~2 as though a ref file keeps that expression dynamically. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git update-ref refs/heads/practice HEAD~2
git rev-parse refs/heads/practice

Explained result. practice stores the object ID that HEAD~2 resolved to at update time. 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: release rehearsal. Contrast the rule using several refs prepare and commit as one transaction. 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 “new-oid and old-oid arguments can be resolvable object names, while the ref ultimately stores an object ID appropriate to its use.” Apply this procedure: State the contract for Object expressions are resolved before storage, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: practice stores the object ID that HEAD~2 resolved to at update time. For the release rehearsal, add one near-miss that exposes recording the text HEAD~2 as though a ref file keeps that expression dynamically. 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 drill. Stress-test the rule using reflog messages explain an intentional repair. 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 “new-oid and old-oid arguments can be resolvable object names, while the ref ultimately stores an object ID appropriate to its use.” Apply this procedure: State the contract for Object expressions are resolved before storage, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: practice stores the object ID that HEAD~2 resolved to at update time. For the recovery drill, add one near-miss that exposes recording the text HEAD~2 as though a ref file keeps that expression dynamically. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Explain the rule using missing refs, symbolic refs, wrong old IDs and lock failures expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “new-oid and old-oid arguments can be resolvable object names, while the ref ultimately stores an object ID appropriate to its use.” Apply this procedure: State the contract for Object expressions are resolved before storage, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: practice stores the object ID that HEAD~2 resolved to at update time. For the test laboratory, add one near-miss that exposes recording the text HEAD~2 as though a ref file keeps that expression dynamically. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Transfer the rule using update-ref is compared with branch, reset, tag and symbolic-ref porcelain. 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 “new-oid and old-oid arguments can be resolvable object names, while the ref ultimately stores an object ID appropriate to its use.” Apply this procedure: State the contract for Object expressions are resolved before storage, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: practice stores the object ID that HEAD~2 resolved to at update time. For the tool decision, add one near-miss that exposes recording the text HEAD~2 as though a ref file keeps that expression dynamically. 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 recording the text HEAD~2 as though a ref file keeps that expression dynamically.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Object expressions are resolved before storage, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from Object expressions are resolved before storage?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing recording the text HEAD~2 as though a ref file keeps that expression dynamically be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny reading notes with a temporary ref is deleted only from the expected value. Include one ordinary case, one boundary and one deliberate failure caused by recording the text HEAD~2 as though a ref file keeps that expression dynamically. 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: new-oid and old-oid arguments can be resolvable object names, while the ref ultimately stores an object ID appropriate to its use. It shows a trace, not only a final value. The ordinary case should demonstrate “practice stores the object ID that HEAD~2 resolved to at update time.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Object expressions are resolved before storage, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Object expressions are resolved before storage, separate the documented Git update-ref 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. Symbolic refs are dereferenced by default

Back to contents

When the named ref is symbolic, the ordinary form updates the referent rather than replacing the symbolic reference itself. 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 update-ref HEAD and assuming HEAD will stop being symbolic. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Symbolic refs are dereferenced by default, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Symbolic refs are dereferenced by default chapter on Git update-ref, 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 update-ref HEAD and assuming HEAD will stop being symbolic. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git symbolic-ref --short HEAD
git update-ref HEAD "$(git rev-parse HEAD)"

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

Four purposeful transfer cases

Case 1: test laboratory. Stress-test the rule using missing refs, symbolic refs, wrong old IDs and lock failures expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “When the named ref is symbolic, the ordinary form updates the referent rather than replacing the symbolic reference itself.” Apply this procedure: State the contract for Symbolic refs are dereferenced by default, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The current branch referent is targeted; HEAD remains a symbolic ref. For the test laboratory, add one near-miss that exposes running update-ref HEAD and assuming HEAD will stop being symbolic. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Explain the rule using update-ref is compared with branch, reset, tag and symbolic-ref porcelain. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “When the named ref is symbolic, the ordinary form updates the referent rather than replacing the symbolic reference itself.” Apply this procedure: State the contract for Symbolic refs are dereferenced by default, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The current branch referent is targeted; HEAD remains a symbolic ref. For the tool decision, add one near-miss that exposes running update-ref HEAD and assuming HEAD will stop being symbolic. 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: revision repository. Transfer the rule using a practice branch moves only from the expected old 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 “When the named ref is symbolic, the ordinary form updates the referent rather than replacing the symbolic reference itself.” Apply this procedure: State the contract for Symbolic refs are dereferenced by default, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The current branch referent is targeted; HEAD remains a symbolic ref. For the revision repository, add one near-miss that exposes running update-ref HEAD and assuming HEAD will stop being symbolic. 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: science report. Predict the rule using a publish ref is created only when absent. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “When the named ref is symbolic, the ordinary form updates the referent rather than replacing the symbolic reference itself.” Apply this procedure: State the contract for Symbolic refs are dereferenced by default, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The current branch referent is targeted; HEAD remains a symbolic ref. For the science report, add one near-miss that exposes running update-ref HEAD and assuming HEAD will stop being symbolic. 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 update-ref HEAD and assuming HEAD will stop being symbolic.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Symbolic refs are dereferenced by default, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from Symbolic refs are dereferenced by default?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing running update-ref HEAD and assuming HEAD will stop being symbolic be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny release rehearsal with several refs prepare and commit as one transaction. Include one ordinary case, one boundary and one deliberate failure caused by running update-ref HEAD and assuming HEAD will stop being symbolic. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: When the named ref is symbolic, the ordinary form updates the referent rather than replacing the symbolic reference itself. It shows a trace, not only a final value. The ordinary case should demonstrate “The current branch referent is targeted; HEAD remains a symbolic ref.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Symbolic refs are dereferenced by default, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Symbolic refs are dereferenced by default, separate the documented Git update-ref 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. –no-deref updates the named ref itself

Back to contents

–no-deref tells update-ref not to follow a symbolic ref before applying the direct ref update. 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 –no-deref on HEAD in a real repository without intending to detach or replace its symbolic state. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for –no-deref updates the named ref itself, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the –no-deref updates the named ref itself chapter on Git update-ref, 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 –no-deref on HEAD in a real repository without intending to detach or replace its symbolic state. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git update-ref --no-deref HEAD "$(git rev-parse HEAD)"

Explained result. HEAD itself becomes a direct object ref in the disposable test, so the checkout is detached. 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: revision repository. Explain the rule using a practice branch moves only from the expected old 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 “–no-deref tells update-ref not to follow a symbolic ref before applying the direct ref update.” Apply this procedure: State the contract for –no-deref updates the named ref itself, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: HEAD itself becomes a direct object ref in the disposable test, so the checkout is detached. For the revision repository, add one near-miss that exposes using –no-deref on HEAD in a real repository without intending to detach or replace its symbolic state. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: science report. Transfer the rule using a publish ref is created only when absent. 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 “–no-deref tells update-ref not to follow a symbolic ref before applying the direct ref update.” Apply this procedure: State the contract for –no-deref updates the named ref itself, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: HEAD itself becomes a direct object ref in the disposable test, so the checkout is detached. For the science report, add one near-miss that exposes using –no-deref on HEAD in a real repository without intending to detach or replace its symbolic state. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: CCA project. Predict the rule using a stale process loses a compare-and-swap race safely. 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 “–no-deref tells update-ref not to follow a symbolic ref before applying the direct ref update.” Apply this procedure: State the contract for –no-deref updates the named ref itself, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: HEAD itself becomes a direct object ref in the disposable test, so the checkout is detached. For the CCA project, add one near-miss that exposes using –no-deref on HEAD in a real repository without intending to detach or replace its symbolic state. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading notes. Contrast the rule using a temporary ref is deleted only from the expected value. 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 “–no-deref tells update-ref not to follow a symbolic ref before applying the direct ref update.” Apply this procedure: State the contract for –no-deref updates the named ref itself, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: HEAD itself becomes a direct object ref in the disposable test, so the checkout is detached. For the reading notes, add one near-miss that exposes using –no-deref on HEAD in a real repository without intending to detach or replace its symbolic state. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers using –no-deref on HEAD in a real repository without intending to detach or replace its symbolic state.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for –no-deref updates the named ref itself, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from –no-deref updates the named ref itself?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using –no-deref on HEAD in a real repository without intending to detach or replace its symbolic state be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny recovery drill with reflog messages explain an intentional repair. Include one ordinary case, one boundary and one deliberate failure caused by using –no-deref on HEAD in a real repository without intending to detach or replace its symbolic state. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: –no-deref tells update-ref not to follow a symbolic ref before applying the direct ref update. It shows a trace, not only a final value. The ordinary case should demonstrate “HEAD itself becomes a direct object ref in the disposable test, so the checkout is detached.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for –no-deref updates the named ref itself, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For –no-deref updates the named ref itself, separate the documented Git update-ref 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. A reflog message records intent

Back to contents

The -m option supplies a reason for the reflog entry when a reflog is written. 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 leaving an automated repair with an unhelpful empty explanation. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for A reflog message records intent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the A reflog message records intent chapter on Git update-ref, 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 leaving an automated repair with an unhelpful empty explanation. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git update-ref -m 'practice: advance after checked build' refs/heads/practice HEAD
git reflog -1 refs/heads/practice

Explained result. The newest reflog entry includes the stated reason, improving later diagnosis. 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: CCA project. Transfer the rule using a stale process loses a compare-and-swap race safely. 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 -m option supplies a reason for the reflog entry when a reflog is written.” Apply this procedure: State the contract for A reflog message records intent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The newest reflog entry includes the stated reason, improving later diagnosis. For the CCA project, add one near-miss that exposes leaving an automated repair with an unhelpful empty explanation. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading notes. Predict the rule using a temporary ref is deleted only from the expected value. 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 -m option supplies a reason for the reflog entry when a reflog is written.” Apply this procedure: State the contract for A reflog message records intent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The newest reflog entry includes the stated reason, improving later diagnosis. For the reading notes, add one near-miss that exposes leaving an automated repair with an unhelpful empty explanation. 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: release rehearsal. Contrast the rule using several refs prepare and commit as one transaction. 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 -m option supplies a reason for the reflog entry when a reflog is written.” Apply this procedure: State the contract for A reflog message records intent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The newest reflog entry includes the stated reason, improving later diagnosis. For the release rehearsal, add one near-miss that exposes leaving an automated repair with an unhelpful empty explanation. 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 drill. Stress-test the rule using reflog messages explain an intentional repair. 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 -m option supplies a reason for the reflog entry when a reflog is written.” Apply this procedure: State the contract for A reflog message records intent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The newest reflog entry includes the stated reason, improving later diagnosis. For the recovery drill, add one near-miss that exposes leaving an automated repair with an unhelpful empty explanation. 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 leaving an automated repair with an unhelpful empty explanation.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for A reflog message records intent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from A reflog message records intent?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing leaving an automated repair with an unhelpful empty explanation be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny test laboratory with missing refs, symbolic refs, wrong old IDs and lock failures expose boundaries. Include one ordinary case, one boundary and one deliberate failure caused by leaving an automated repair with an unhelpful empty explanation. 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 -m option supplies a reason for the reflog entry when a reflog is written. It shows a trace, not only a final value. The ordinary case should demonstrate “The newest reflog entry includes the stated reason, improving later diagnosis.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for A reflog message records intent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For A reflog message records intent, separate the documented Git update-ref 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. –create-reflog requests a reflog

Back to contents

–create-reflog asks Git to create a reflog for the updated ref even when ordinary policy would not create one. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is assuming every namespace on every repository already records reflogs. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for –create-reflog requests a reflog, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the –create-reflog requests a reflog chapter on Git update-ref, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on assuming every namespace on every repository already records reflogs. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git update-ref --create-reflog -m 'record lesson checkpoint' refs/lesson/checkpoint HEAD

Explained result. The custom lesson ref is updated with an explicitly requested reflog. 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: release rehearsal. Predict the rule using several refs prepare and commit as one transaction. 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 “–create-reflog asks Git to create a reflog for the updated ref even when ordinary policy would not create one.” Apply this procedure: State the contract for –create-reflog requests a reflog, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The custom lesson ref is updated with an explicitly requested reflog. For the release rehearsal, add one near-miss that exposes assuming every namespace on every repository already records reflogs. 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 drill. Contrast the rule using reflog messages explain an intentional repair. 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 “–create-reflog asks Git to create a reflog for the updated ref even when ordinary policy would not create one.” Apply this procedure: State the contract for –create-reflog requests a reflog, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The custom lesson ref is updated with an explicitly requested reflog. For the recovery drill, add one near-miss that exposes assuming every namespace on every repository already records reflogs. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Stress-test the rule using missing refs, symbolic refs, wrong old IDs and lock failures expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “–create-reflog asks Git to create a reflog for the updated ref even when ordinary policy would not create one.” Apply this procedure: State the contract for –create-reflog requests a reflog, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The custom lesson ref is updated with an explicitly requested reflog. For the test laboratory, add one near-miss that exposes assuming every namespace on every repository already records reflogs. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Explain the rule using update-ref is compared with branch, reset, tag and symbolic-ref porcelain. 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 “–create-reflog asks Git to create a reflog for the updated ref even when ordinary policy would not create one.” Apply this procedure: State the contract for –create-reflog requests a reflog, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The custom lesson ref is updated with an explicitly requested reflog. For the tool decision, add one near-miss that exposes assuming every namespace on every repository already records reflogs. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

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

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from –create-reflog requests a reflog?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming every namespace on every repository already records reflogs be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny tool decision with update-ref is compared with branch, reset, tag and symbolic-ref porcelain. Include one ordinary case, one boundary and one deliberate failure caused by assuming every namespace on every repository already records reflogs. 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: –create-reflog asks Git to create a reflog for the updated ref even when ordinary policy would not create one. It shows a trace, not only a final value. The ordinary case should demonstrate “The custom lesson ref is updated with an explicitly requested reflog.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for –create-reflog requests a reflog, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For –create-reflog requests a reflog, separate the documented Git update-ref 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. –stdin update expresses one command per line

Back to contents

In stdin mode, an update command supplies ref, new value and optional old value using the documented command grammar. 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 building shell-evaluated strings whose quoting changes the ref protocol. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for –stdin update expresses one command per line, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the –stdin update expresses one command per line chapter on Git update-ref, 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 building shell-evaluated strings whose quoting changes the ref protocol. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

printf 'update refs/heads/practice %s %s\n' "$new" "$old" | git update-ref --stdin

Explained result. Git parses one update command and enforces the same expected-old precondition. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: test laboratory. Contrast the rule using missing refs, symbolic refs, wrong old IDs and lock failures expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “In stdin mode, an update command supplies ref, new value and optional old value using the documented command grammar.” Apply this procedure: State the contract for –stdin update expresses one command per line, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Git parses one update command and enforces the same expected-old precondition. For the test laboratory, add one near-miss that exposes building shell-evaluated strings whose quoting changes the ref protocol. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Stress-test the rule using update-ref is compared with branch, reset, tag and symbolic-ref porcelain. 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 “In stdin mode, an update command supplies ref, new value and optional old value using the documented command grammar.” Apply this procedure: State the contract for –stdin update expresses one command per line, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Git parses one update command and enforces the same expected-old precondition. For the tool decision, add one near-miss that exposes building shell-evaluated strings whose quoting changes the ref protocol. 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: revision repository. Explain the rule using a practice branch moves only from the expected old 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 “In stdin mode, an update command supplies ref, new value and optional old value using the documented command grammar.” Apply this procedure: State the contract for –stdin update expresses one command per line, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Git parses one update command and enforces the same expected-old precondition. For the revision repository, add one near-miss that exposes building shell-evaluated strings whose quoting changes the ref protocol. 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: science report. Transfer the rule using a publish ref is created only when absent. 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 “In stdin mode, an update command supplies ref, new value and optional old value using the documented command grammar.” Apply this procedure: State the contract for –stdin update expresses one command per line, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Git parses one update command and enforces the same expected-old precondition. For the science report, add one near-miss that exposes building shell-evaluated strings whose quoting changes the ref protocol. 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 building shell-evaluated strings whose quoting changes the ref protocol.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for –stdin update expresses one command per line, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from –stdin update expresses one command per line?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing building shell-evaluated strings whose quoting changes the ref protocol be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny revision repository with a practice branch moves only from the expected old commit. Include one ordinary case, one boundary and one deliberate failure caused by building shell-evaluated strings whose quoting changes the ref protocol. 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: In stdin mode, an update command supplies ref, new value and optional old value using the documented command grammar. It shows a trace, not only a final value. The ordinary case should demonstrate “Git parses one update command and enforces the same expected-old precondition.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for –stdin update expresses one command per line, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For –stdin update expresses one command per line, separate the documented Git update-ref 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. –stdin create asserts absence

Back to contents

The create command states that a ref must not exist before it receives the new object. 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 update without an old value for a name whose absence matters. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for –stdin create asserts absence, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the –stdin create asserts absence chapter on Git update-ref, 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 update without an old value for a name whose absence matters. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

printf 'create refs/heads/new-topic %s\n' "$new" | git update-ref --stdin

Explained result. The command fails instead of overwriting an existing new-topic ref. 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: revision repository. Stress-test the rule using a practice branch moves only from the expected old 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 create command states that a ref must not exist before it receives the new object.” Apply this procedure: State the contract for –stdin create asserts absence, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The command fails instead of overwriting an existing new-topic ref. For the revision repository, add one near-miss that exposes using update without an old value for a name whose absence matters. 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: science report. Explain the rule using a publish ref is created only when absent. 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 create command states that a ref must not exist before it receives the new object.” Apply this procedure: State the contract for –stdin create asserts absence, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The command fails instead of overwriting an existing new-topic ref. For the science report, add one near-miss that exposes using update without an old value for a name whose absence matters. 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: CCA project. Transfer the rule using a stale process loses a compare-and-swap race safely. 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 create command states that a ref must not exist before it receives the new object.” Apply this procedure: State the contract for –stdin create asserts absence, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The command fails instead of overwriting an existing new-topic ref. For the CCA project, add one near-miss that exposes using update without an old value for a name whose absence matters. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading notes. Predict the rule using a temporary ref is deleted only from the expected value. 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 create command states that a ref must not exist before it receives the new object.” Apply this procedure: State the contract for –stdin create asserts absence, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The command fails instead of overwriting an existing new-topic ref. For the reading notes, add one near-miss that exposes using update without an old value for a name whose absence matters. 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 update without an old value for a name whose absence matters.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for –stdin create asserts absence, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from –stdin create asserts absence?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using update without an old value for a name whose absence matters be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny science report with a publish ref is created only when absent. Include one ordinary case, one boundary and one deliberate failure caused by using update without an old value for a name whose absence matters. 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 create command states that a ref must not exist before it receives the new object. It shows a trace, not only a final value. The ordinary case should demonstrate “The command fails instead of overwriting an existing new-topic ref.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for –stdin create asserts absence, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For –stdin create asserts absence, separate the documented Git update-ref 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. –stdin delete and verify make preconditions explicit

Back to contents

delete removes a matching ref, while verify checks the current value without assigning a new one. 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 conflating a read made earlier with a transaction-time verification. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for –stdin delete and verify make preconditions explicit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the –stdin delete and verify make preconditions explicit chapter on Git update-ref, 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 conflating a read made earlier with a transaction-time verification. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

printf 'verify refs/heads/practice %s\ndelete refs/heads/temp %s\n' "$expected" "$temp_old" | git update-ref --stdin

Explained result. Git evaluates the declared current-value expectations as part of the batch. 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: CCA project. Explain the rule using a stale process loses a compare-and-swap race safely. 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 “delete removes a matching ref, while verify checks the current value without assigning a new one.” Apply this procedure: State the contract for –stdin delete and verify make preconditions explicit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Git evaluates the declared current-value expectations as part of the batch. For the CCA project, add one near-miss that exposes conflating a read made earlier with a transaction-time verification. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading notes. Transfer the rule using a temporary ref is deleted only from the expected value. 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 “delete removes a matching ref, while verify checks the current value without assigning a new one.” Apply this procedure: State the contract for –stdin delete and verify make preconditions explicit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Git evaluates the declared current-value expectations as part of the batch. For the reading notes, add one near-miss that exposes conflating a read made earlier with a transaction-time verification. 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: release rehearsal. Predict the rule using several refs prepare and commit as one transaction. 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 “delete removes a matching ref, while verify checks the current value without assigning a new one.” Apply this procedure: State the contract for –stdin delete and verify make preconditions explicit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Git evaluates the declared current-value expectations as part of the batch. For the release rehearsal, add one near-miss that exposes conflating a read made earlier with a transaction-time verification. 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 drill. Contrast the rule using reflog messages explain an intentional repair. 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 “delete removes a matching ref, while verify checks the current value without assigning a new one.” Apply this procedure: State the contract for –stdin delete and verify make preconditions explicit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Git evaluates the declared current-value expectations as part of the batch. For the recovery drill, add one near-miss that exposes conflating a read made earlier with a transaction-time verification. 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 conflating a read made earlier with a transaction-time verification.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for –stdin delete and verify make preconditions explicit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from –stdin delete and verify make preconditions explicit?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing conflating a read made earlier with a transaction-time verification be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny CCA project with a stale process loses a compare-and-swap race safely. Include one ordinary case, one boundary and one deliberate failure caused by conflating a read made earlier with a transaction-time verification. 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: delete removes a matching ref, while verify checks the current value without assigning a new one. It shows a trace, not only a final value. The ordinary case should demonstrate “Git evaluates the declared current-value expectations as part of the batch.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for –stdin delete and verify make preconditions explicit, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For –stdin delete and verify make preconditions explicit, separate the documented Git update-ref 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. start prepare commit forms an explicit transaction

Back to contents

stdin transaction controls can start a transaction, prepare locks and validates queued updates, and commit applies the prepared transaction. 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 newline batching alone explains every all-or-nothing boundary. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for start prepare commit forms an explicit transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the start prepare commit forms an explicit transaction chapter on Git update-ref, 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 newline batching alone explains every all-or-nothing boundary. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

{ printf 'start\n'; printf 'update refs/heads/a %s %s\n' "$newa" "$olda"; printf 'update refs/heads/b %s %s\n' "$newb" "$oldb"; printf 'prepare\ncommit\n'; } | git update-ref --stdin

Explained result. Both declared updates are prepared together and commit only after validation succeeds. 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: release rehearsal. Transfer the rule using several refs prepare and commit as one transaction. 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 “stdin transaction controls can start a transaction, prepare locks and validates queued updates, and commit applies the prepared transaction.” Apply this procedure: State the contract for start prepare commit forms an explicit transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Both declared updates are prepared together and commit only after validation succeeds. For the release rehearsal, add one near-miss that exposes assuming newline batching alone explains every all-or-nothing boundary. 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 drill. Predict the rule using reflog messages explain an intentional repair. 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 “stdin transaction controls can start a transaction, prepare locks and validates queued updates, and commit applies the prepared transaction.” Apply this procedure: State the contract for start prepare commit forms an explicit transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Both declared updates are prepared together and commit only after validation succeeds. For the recovery drill, add one near-miss that exposes assuming newline batching alone explains every all-or-nothing boundary. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Contrast the rule using missing refs, symbolic refs, wrong old IDs and lock failures expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “stdin transaction controls can start a transaction, prepare locks and validates queued updates, and commit applies the prepared transaction.” Apply this procedure: State the contract for start prepare commit forms an explicit transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Both declared updates are prepared together and commit only after validation succeeds. For the test laboratory, add one near-miss that exposes assuming newline batching alone explains every all-or-nothing boundary. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Stress-test the rule using update-ref is compared with branch, reset, tag and symbolic-ref porcelain. 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 “stdin transaction controls can start a transaction, prepare locks and validates queued updates, and commit applies the prepared transaction.” Apply this procedure: State the contract for start prepare commit forms an explicit transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: Both declared updates are prepared together and commit only after validation succeeds. For the tool decision, add one near-miss that exposes assuming newline batching alone explains every all-or-nothing boundary. 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 newline batching alone explains every all-or-nothing boundary.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for start prepare commit forms an explicit transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from start prepare commit forms an explicit transaction?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming newline batching alone explains every all-or-nothing boundary be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny reading notes with a temporary ref is deleted only from the expected value. Include one ordinary case, one boundary and one deliberate failure caused by assuming newline batching alone explains every all-or-nothing boundary. 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: stdin transaction controls can start a transaction, prepare locks and validates queued updates, and commit applies the prepared transaction. It shows a trace, not only a final value. The ordinary case should demonstrate “Both declared updates are prepared together and commit only after validation succeeds.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for start prepare commit forms an explicit transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For start prepare commit forms an explicit transaction, separate the documented Git update-ref 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. abort discards an open transaction

Back to contents

The abort control ends the current stdin transaction without committing its queued reference 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 testing abort in an important repository without first recording baseline refs. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for abort discards an open transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the abort discards an open transaction chapter on Git update-ref, 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 testing abort in an important repository without first recording baseline refs. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

{ printf 'start\n'; printf 'update refs/heads/practice %s %s\n' "$new" "$old"; printf 'abort\n'; } | git update-ref --stdin

Explained result. practice remains at old because the queued update is abandoned. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: test laboratory. Predict the rule using missing refs, symbolic refs, wrong old IDs and lock failures expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The abort control ends the current stdin transaction without committing its queued reference changes.” Apply this procedure: State the contract for abort discards an open transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: practice remains at old because the queued update is abandoned. For the test laboratory, add one near-miss that exposes testing abort in an important repository without first recording baseline refs. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Contrast the rule using update-ref is compared with branch, reset, tag and symbolic-ref porcelain. 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 abort control ends the current stdin transaction without committing its queued reference changes.” Apply this procedure: State the contract for abort discards an open transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: practice remains at old because the queued update is abandoned. For the tool decision, add one near-miss that exposes testing abort in an important repository without first recording baseline refs. 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: revision repository. Stress-test the rule using a practice branch moves only from the expected old 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 abort control ends the current stdin transaction without committing its queued reference changes.” Apply this procedure: State the contract for abort discards an open transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: practice remains at old because the queued update is abandoned. For the revision repository, add one near-miss that exposes testing abort in an important repository without first recording baseline refs. 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: science report. Explain the rule using a publish ref is created only when absent. 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 abort control ends the current stdin transaction without committing its queued reference changes.” Apply this procedure: State the contract for abort discards an open transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: practice remains at old because the queued update is abandoned. For the science report, add one near-miss that exposes testing abort in an important repository without first recording baseline refs. 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 testing abort in an important repository without first recording baseline refs.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for abort discards an open transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from abort discards an open transaction?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing testing abort in an important repository without first recording baseline refs be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny release rehearsal with several refs prepare and commit as one transaction. Include one ordinary case, one boundary and one deliberate failure caused by testing abort in an important repository without first recording baseline refs. 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 abort control ends the current stdin transaction without committing its queued reference changes. It shows a trace, not only a final value. The ordinary case should demonstrate “practice remains at old because the queued update is abandoned.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for abort discards an open transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For abort discards an open transaction, separate the documented Git update-ref 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. -z uses NUL-delimited input fields

Back to contents

With -z, stdin fields are terminated by NUL bytes under the command’s NUL grammar, avoiding line-oriented quoting ambiguities. 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 -z while still sending the line grammar and newline separators. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for -z uses NUL-delimited input fields, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the -z uses NUL-delimited input fields chapter on Git update-ref, 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 -z while still sending the line grammar and newline separators. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

printf 'update refs/heads/practice\0%s\0%s\0' "$new" "$old" | git update-ref --stdin -z

Explained result. The NUL form must follow its documented field layout exactly; mixing grammars is rejected. 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: revision repository. Contrast the rule using a practice branch moves only from the expected old 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 -z, stdin fields are terminated by NUL bytes under the command’s NUL grammar, avoiding line-oriented quoting ambiguities.” Apply this procedure: State the contract for -z uses NUL-delimited input fields, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The NUL form must follow its documented field layout exactly; mixing grammars is rejected. For the revision repository, add one near-miss that exposes adding -z while still sending the line grammar and newline separators. 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: science report. Stress-test the rule using a publish ref is created only when absent. 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 -z, stdin fields are terminated by NUL bytes under the command’s NUL grammar, avoiding line-oriented quoting ambiguities.” Apply this procedure: State the contract for -z uses NUL-delimited input fields, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The NUL form must follow its documented field layout exactly; mixing grammars is rejected. For the science report, add one near-miss that exposes adding -z while still sending the line grammar and newline separators. 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: CCA project. Explain the rule using a stale process loses a compare-and-swap race safely. 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 -z, stdin fields are terminated by NUL bytes under the command’s NUL grammar, avoiding line-oriented quoting ambiguities.” Apply this procedure: State the contract for -z uses NUL-delimited input fields, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The NUL form must follow its documented field layout exactly; mixing grammars is rejected. For the CCA project, add one near-miss that exposes adding -z while still sending the line grammar and newline separators. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: reading notes. Transfer the rule using a temporary ref is deleted only from the expected value. 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 -z, stdin fields are terminated by NUL bytes under the command’s NUL grammar, avoiding line-oriented quoting ambiguities.” Apply this procedure: State the contract for -z uses NUL-delimited input fields, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The NUL form must follow its documented field layout exactly; mixing grammars is rejected. For the reading notes, add one near-miss that exposes adding -z while still sending the line grammar and newline separators. 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 -z while still sending the line grammar and newline separators.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for -z uses NUL-delimited input fields, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from -z uses NUL-delimited input fields?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing adding -z while still sending the line grammar and newline separators be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny recovery drill with reflog messages explain an intentional repair. Include one ordinary case, one boundary and one deliberate failure caused by adding -z while still sending the line grammar and newline separators. 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 -z, stdin fields are terminated by NUL bytes under the command’s NUL grammar, avoiding line-oriented quoting ambiguities. It shows a trace, not only a final value. The ordinary case should demonstrate “The NUL form must follow its documented field layout exactly; mixing grammars is rejected.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for -z uses NUL-delimited input fields, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For -z uses NUL-delimited input fields, separate the documented Git update-ref 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. stdin supports symbolic-ref commands

Back to contents

symref-update, symref-create, symref-delete and symref-verify manage symbolic references with explicit referent preconditions. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is storing the characters refs/heads/main as an object ID with an ordinary update command. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for stdin supports symbolic-ref commands, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the stdin supports symbolic-ref commands chapter on Git update-ref, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on storing the characters refs/heads/main as an object ID with an ordinary update command. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

printf 'symref-create refs/heads/current refs/heads/main\n' | git update-ref --stdin

Explained result. current becomes a symbolic ref to main rather than an object-ID ref. 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: CCA project. Stress-test the rule using a stale process loses a compare-and-swap race safely. 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 “symref-update, symref-create, symref-delete and symref-verify manage symbolic references with explicit referent preconditions.” Apply this procedure: State the contract for stdin supports symbolic-ref commands, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: current becomes a symbolic ref to main rather than an object-ID ref. For the CCA project, add one near-miss that exposes storing the characters refs/heads/main as an object ID with an ordinary update command. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: reading notes. Explain the rule using a temporary ref is deleted only from the expected value. 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 “symref-update, symref-create, symref-delete and symref-verify manage symbolic references with explicit referent preconditions.” Apply this procedure: State the contract for stdin supports symbolic-ref commands, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: current becomes a symbolic ref to main rather than an object-ID ref. For the reading notes, add one near-miss that exposes storing the characters refs/heads/main as an object ID with an ordinary update command. 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: release rehearsal. Transfer the rule using several refs prepare and commit as one transaction. 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 “symref-update, symref-create, symref-delete and symref-verify manage symbolic references with explicit referent preconditions.” Apply this procedure: State the contract for stdin supports symbolic-ref commands, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: current becomes a symbolic ref to main rather than an object-ID ref. For the release rehearsal, add one near-miss that exposes storing the characters refs/heads/main as an object ID with an ordinary update command. 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 drill. Predict the rule using reflog messages explain an intentional repair. 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 “symref-update, symref-create, symref-delete and symref-verify manage symbolic references with explicit referent preconditions.” Apply this procedure: State the contract for stdin supports symbolic-ref commands, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: current becomes a symbolic ref to main rather than an object-ID ref. For the recovery drill, add one near-miss that exposes storing the characters refs/heads/main as an object ID with an ordinary update command. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers storing the characters refs/heads/main as an object ID with an ordinary update command.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for stdin supports symbolic-ref commands, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from stdin supports symbolic-ref commands?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing storing the characters refs/heads/main as an object ID with an ordinary update command be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny test laboratory with missing refs, symbolic refs, wrong old IDs and lock failures expose boundaries. Include one ordinary case, one boundary and one deliberate failure caused by storing the characters refs/heads/main as an object ID with an ordinary update command. 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: symref-update, symref-create, symref-delete and symref-verify manage symbolic references with explicit referent preconditions. It shows a trace, not only a final value. The ordinary case should demonstrate “current becomes a symbolic ref to main rather than an object-ID ref.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for stdin supports symbolic-ref commands, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For stdin supports symbolic-ref commands, separate the documented Git update-ref 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. Lock failures and races require rereading

Back to contents

Another process, permissions or namespace conflicts can prevent locking; a failure is evidence that current state must be inspected before a new decision. 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 blindly retrying the same intended move until it overwrites newer work. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Lock failures and races require rereading, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Lock failures and races require rereading chapter on Git update-ref, 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 blindly retrying the same intended move until it overwrites newer work. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git rev-parse refs/heads/practice
git reflog -5 refs/heads/practice

Explained result. The recovery begins by observing the current ref and recent changes, then deriving a new expected-old value only if the move is still valid. 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: release rehearsal. Explain the rule using several refs prepare and commit as one transaction. 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 “Another process, permissions or namespace conflicts can prevent locking; a failure is evidence that current state must be inspected before a new decision.” Apply this procedure: State the contract for Lock failures and races require rereading, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The recovery begins by observing the current ref and recent changes, then deriving a new expected-old value only if the move is still valid. For the release rehearsal, add one near-miss that exposes blindly retrying the same intended move until it overwrites newer work. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: recovery drill. Transfer the rule using reflog messages explain an intentional repair. 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 “Another process, permissions or namespace conflicts can prevent locking; a failure is evidence that current state must be inspected before a new decision.” Apply this procedure: State the contract for Lock failures and races require rereading, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The recovery begins by observing the current ref and recent changes, then deriving a new expected-old value only if the move is still valid. For the recovery drill, add one near-miss that exposes blindly retrying the same intended move until it overwrites newer work. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: test laboratory. Predict the rule using missing refs, symbolic refs, wrong old IDs and lock failures expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Another process, permissions or namespace conflicts can prevent locking; a failure is evidence that current state must be inspected before a new decision.” Apply this procedure: State the contract for Lock failures and races require rereading, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The recovery begins by observing the current ref and recent changes, then deriving a new expected-old value only if the move is still valid. For the test laboratory, add one near-miss that exposes blindly retrying the same intended move until it overwrites newer work. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: tool decision. Contrast the rule using update-ref is compared with branch, reset, tag and symbolic-ref porcelain. 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 “Another process, permissions or namespace conflicts can prevent locking; a failure is evidence that current state must be inspected before a new decision.” Apply this procedure: State the contract for Lock failures and races require rereading, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The recovery begins by observing the current ref and recent changes, then deriving a new expected-old value only if the move is still valid. For the tool decision, add one near-miss that exposes blindly retrying the same intended move until it overwrites newer work. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers blindly retrying the same intended move until it overwrites newer work.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Lock failures and races require rereading, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from Lock failures and races require rereading?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing blindly retrying the same intended move until it overwrites newer work be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny tool decision with update-ref is compared with branch, reset, tag and symbolic-ref porcelain. Include one ordinary case, one boundary and one deliberate failure caused by blindly retrying the same intended move until it overwrites newer work. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Another process, permissions or namespace conflicts can prevent locking; a failure is evidence that current state must be inspected before a new decision. It shows a trace, not only a final value. The ordinary case should demonstrate “The recovery begins by observing the current ref and recent changes, then deriving a new expected-old value only if the move is still valid.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Lock failures and races require rereading, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Lock failures and races require rereading, separate the documented Git update-ref mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 20 OF 20 . Transfer with judgment

20. Choose update-ref for checked plumbing changes

Back to contents

Use update-ref when tooling needs explicit ref preconditions and transactions; use branch, switch, reset, tag or symbolic-ref when their user-facing workflow is the actual job. 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 replacing clear porcelain with plumbing and making ordinary maintenance harder to review. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the contract for Choose update-ref for checked plumbing changes, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.

For the Choose update-ref for checked plumbing changes chapter on Git update-ref, 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 replacing clear porcelain with plumbing and making ordinary maintenance harder to review. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

git update-ref -m 'automation: publish verified commit' refs/heads/published "$new" "$old"

Explained result. The plumbing command is justified because the automation needs a checked compare-and-swap ref transition. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: test laboratory. Transfer the rule using missing refs, symbolic refs, wrong old IDs and lock failures expose boundaries. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use update-ref when tooling needs explicit ref preconditions and transactions; use branch, switch, reset, tag or symbolic-ref when their user-facing workflow is the actual job.” Apply this procedure: State the contract for Choose update-ref for checked plumbing changes, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The plumbing command is justified because the automation needs a checked compare-and-swap ref transition. For the test laboratory, add one near-miss that exposes replacing clear porcelain with plumbing and making ordinary maintenance harder to review. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: tool decision. Predict the rule using update-ref is compared with branch, reset, tag and symbolic-ref porcelain. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use update-ref when tooling needs explicit ref preconditions and transactions; use branch, switch, reset, tag or symbolic-ref when their user-facing workflow is the actual job.” Apply this procedure: State the contract for Choose update-ref for checked plumbing changes, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The plumbing command is justified because the automation needs a checked compare-and-swap ref transition. For the tool decision, add one near-miss that exposes replacing clear porcelain with plumbing and making ordinary maintenance harder to review. 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: revision repository. Contrast the rule using a practice branch moves only from the expected old 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 “Use update-ref when tooling needs explicit ref preconditions and transactions; use branch, switch, reset, tag or symbolic-ref when their user-facing workflow is the actual job.” Apply this procedure: State the contract for Choose update-ref for checked plumbing changes, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The plumbing command is justified because the automation needs a checked compare-and-swap ref transition. For the revision repository, add one near-miss that exposes replacing clear porcelain with plumbing and making ordinary maintenance harder to review. 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: science report. Stress-test the rule using a publish ref is created only when absent. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use update-ref when tooling needs explicit ref preconditions and transactions; use branch, switch, reset, tag or symbolic-ref when their user-facing workflow is the actual job.” Apply this procedure: State the contract for Choose update-ref for checked plumbing changes, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. The expected mechanism is: The plumbing command is justified because the automation needs a checked compare-and-swap ref transition. For the science report, add one near-miss that exposes replacing clear porcelain with plumbing and making ordinary maintenance harder to review. 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 replacing clear porcelain with plumbing and making ordinary maintenance harder to review.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the contract for Choose update-ref for checked plumbing changes, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final Git update-ref syntax. For this chapter, useful prompts are: “What did you expect from Choose update-ref for checked plumbing changes?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing replacing clear porcelain with plumbing and making ordinary maintenance harder to review be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny revision repository with a practice branch moves only from the expected old commit. Include one ordinary case, one boundary and one deliberate failure caused by replacing clear porcelain with plumbing and making ordinary maintenance harder to review. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Use update-ref when tooling needs explicit ref preconditions and transactions; use branch, switch, reset, tag or symbolic-ref when their user-facing workflow is the actual job. It shows a trace, not only a final value. The ordinary case should demonstrate “The plumbing command is justified because the automation needs a checked compare-and-swap ref transition.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the contract for Choose update-ref for checked plumbing changes, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Choose update-ref for checked plumbing changes, separate the documented Git update-ref 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. revision repository: model, boundary and recovery

Create a small revision repository using a practice branch moves only from the expected old commit. Combine “Two-argument update moves a ref” 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: git update-ref resolves the new object name and safely updates the named reference. Apply: State the contract for Two-argument update moves a ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: refs/heads/practice points at the resolved HEAD object after Git completes the locked 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.

2. science report: model, boundary and recovery

Create a small science report using a publish ref is created only when absent. Combine “A wrong old object rejects without moving the ref” 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: When the expected old value differs, update-ref fails and leaves the current reference unchanged. Apply: State the contract for A wrong old object rejects without moving the ref, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The stale comparison is rejected and the equality check confirms no move. 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. CCA project: model, boundary and recovery

Create a small CCA project using a stale process loses a compare-and-swap race safely. Combine “Object expressions are resolved before storage” 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: new-oid and old-oid arguments can be resolvable object names, while the ref ultimately stores an object ID appropriate to its use. Apply: State the contract for Object expressions are resolved before storage, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: practice stores the object ID that HEAD~2 resolved to at update time. 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. reading notes: model, boundary and recovery

Create a small reading notes using a temporary ref is deleted only from the expected value. Combine “A reflog message records intent” 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 -m option supplies a reason for the reflog entry when a reflog is written. Apply: State the contract for A reflog message records intent, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The newest reflog entry includes the stated reason, improving later diagnosis. 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. release rehearsal: model, boundary and recovery

Create a small release rehearsal using several refs prepare and commit as one transaction. Combine “–stdin create asserts absence” 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 create command states that a ref must not exist before it receives the new object. Apply: State the contract for –stdin create asserts absence, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The command fails instead of overwriting an existing new-topic ref. 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. recovery drill: model, boundary and recovery

Create a small recovery drill using reflog messages explain an intentional repair. Combine “abort discards an open transaction” 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 abort control ends the current stdin transaction without committing its queued reference changes. Apply: State the contract for abort discards an open transaction, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: practice remains at old because the queued update is abandoned. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

7. test laboratory: model, boundary and recovery

Create a small test laboratory using missing refs, symbolic refs, wrong old IDs and lock failures expose boundaries. Combine “Lock failures and races require rereading” 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: Another process, permissions or namespace conflicts can prevent locking; a failure is evidence that current state must be inspected before a new decision. Apply: State the contract for Lock failures and races require rereading, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The recovery begins by observing the current ref and recent changes, then deriving a new expected-old value only if the move is still valid. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

8. tool decision: model, boundary and recovery

Create a small tool decision using update-ref is compared with branch, reset, tag and symbolic-ref porcelain. Combine “An expected old object adds compare-and-swap safety” 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: Providing old-oid requires the ref’s current value to match before it is changed. Apply: State the contract for An expected old object adds compare-and-swap safety, predict one ordinary case and one boundary, run the smallest disposable test, then explain the earliest difference between prediction and evidence. Verify: The move succeeds only if practice still equals old when the lock is checked. 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 的更多信息

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

继续阅读