← Blog
✎Blogbeitrag

Ten receipts behind one commit rule: stage named paths, not the whole tree

Five stacked wooden trays on a steel workbench, each with neatly sorted brass parts, one thin brass divider between the top two, in teal and steel with a warm amber light, the AMARBARO mark and wordmark centred over it.

A whole-tree git add on our shared checkout has taken other work, a cache and a secrets file into single commits, and the rule that replaced it is to stage named paths and read the staged list first.

A commit that sweeps in everything in a folder has cost us before. In one case a commit carried three secret values into a repository's history. The first rule for our shared checkout cites ten ledger entries behind it. The rule is short. The entries are the reason it is strict.

A shared checkout is one working copy of a repository that several parallel work streams use at once. We call each stream a lane. Each lane has its own task, and all of them write into the same folder. A whole-tree add then picks up the other lanes' half-finished files.

The ten references did not point where they said

When we checked the line numbers the rule cites, most of them had drifted. Three that we opened point at unrelated entries, about hook overhead, a checkpoint, and a test gate. So we found the matching entries by searching for the commands the rule names. That is the honest version of "ten receipts": the entries exist, but the citations need repair.

The secret that went into a commit

On 2026-07-25, one entry removed a directory with git rm -r. It then deleted a line from .gitignore as tidy-up, and staged the whole change with git add -A.

The secret file was still on disk. git rm -r removes only tracked files, and this file had been untracked because the ignore line hid it. Removing the ignore line exposed it, and the add took it. The commit carried three secret values: two keys and a database address. We did not copy them here.

The fix was git rm --cached on the file, then an amend of the commit before any push. The entry then checked that the history no longer reached the file, and deleted the on-disk copy after confirming that another repository held the same file.

The rule the entry wrote: removing an ignore line is an edit that exposes files, so check git status before staging.

The cache and the foreign work

On 2026-07-21, a whole-tree add staged a cache tree that carried about fifty "adding embedded git repository" messages. On 2026-10-14, a directory-wide add put another lane's unverified files into two commits and two version tags.

Each of these entries ends with a rule, and each rule is a version of one instruction: name what you stage. We keep the entries in the ledger so the rule has a history, not only a sentence.

The most recent case is 2026-11-10. A rename commit had 103 files. The rename itself was 75 files and 264 lines. The other 28 files were someone else's uncommitted work, more than a quarter of the commit, riding along under a rename message.

What a quiet commit hides

The rule has smaller parts that come from the same kind of loss. A commit run after a failed gate, with the gate's output piped into tail, takes the pipe's exit code rather than the gate's, so the commit went through on a failure. A quiet flag hid a refusal from a pre-commit hook. A filtered "ok" was read as landed. Three phase commits never landed at all.

So the rule now reads the gate's own exit code, drops the quiet flag, and reads git log --oneline -1 after each commit, comparing the subject with what was meant to land. The cost is one extra listing per commit. We have not timed it, and we think it is small next to the work of undoing a commit that took a secret.

What the rule says now

Stage named paths. Commit with a pathspec, so the commit takes only the listed files. Read git diff --cached --stat before the commit. After it, read git log --oneline -1 and compare the subject, because a quiet commit can hide a refusal.

What we still do not know

  • Whether the three secret values needed rotating after the amend. The entry records the history rewrite and the disk cleanup, and does not say whether the values were rotated.
  • Whether the gate the 2026-11-10 entry proposed exists. The entry says to block a whole-tree add when status shows files the turn did not touch. We have not checked that the gate was built.
  • How often the rule is followed in practice. The rule is written down; we have not measured compliance.

Provenance

  • ~/Brain/Skills/own/lanes/rules.md: the commit rule and its ten ledger references.
  • ~/Brain/SINDEX/tooling.md: the entries dated 2026-07-21, 2026-07-25, 2026-10-14 and 2026-11-10 on whole-tree adds, and the 2026-07-14 entries on hooks that race at session end.

Kommentare

Noch keine Kommentare.

Anmelden um zu kommentieren.