Skip to content
rajin

30Capstone: build a repository with plumbing

capstone45–60 minHandbook pp. 65–66 Not started

Warm-up · from “Debugging history with bisect and blame”

What is required for useful bisect results?

No notes: write what you remember, then check. Recalling before reading is what makes it stick.

The problem

You are asked to demonstrate that you understand Git without its convenient high-level commands. Build two commits and a release branch from scratch.

After this lesson you can

  • Construct a complete two-commit DAG with plumbing.

  • Verify tree structure and parent identity.

  • Explain Index and working-tree state.

Key terms

Full glossary

Say what each term means, then open it to check.

  • DAG · from lesson 13

    Directed acyclic graph; commit edges point to parents.

  • Index · from lesson 9

    Prepared path-to-object entries, plus metadata and conflict stages.

  • Commit · from lesson 7

    Object identifying a root tree, parent(s), metadata and message.

  • Tree · from lesson 6

    Directory snapshot mapping names, modes and object IDs.

Visual mental model

  1. C1release
  2. C2main
Arrows show parent links (from child to parent). Branch labels identify tips.

Build the mental model

The required history begins with Commit 1 on main containing readme.txt with Core v1 plus newline. Commit 2 updates readme.txt to Core v2 plus newline and adds src/app.txt containing App plus newline; its parent is Commit 1. A release ref must point at Commit 1. Do not use git add, git commit or git branch during construction. Use supported plumbing rather than editing loose ref files directly.

Computed in your browser · exactPlan your objects

Computed in your browser: sketch C1 and C2 before building them in the sandbox.

Under the hood

Before touching the terminal, draw the intended graph and list each object you need. The second tree reuses any unchanged objects if present; it must include the subtree for src. update-index can create a full-path entry and write-tree builds the hierarchy. commit-tree -p establishes parenthood. update-ref names the commits. Verify with cat-file, ls-tree and log, then restore files if desired.

Common mistake · important nuance

This is an independent challenge; read the lab instructions below as a verifier, not a command recipe. The complete construction appears in the answer appendix.

Move between parts freely. Completion counts only what you verify and answer.