Skip to content

parallel-teammate-git-index-race

Parallel Teammate — Race-Free Git Commit & Branch Primitive

Section titled “Parallel Teammate — Race-Free Git Commit & Branch Primitive”

Parallel teammates share one git working tree, index, and HEAD. Six anti-patterns are BANNED:

  1. Two-step git add + git commit — sweeps in a sibling’s staged files.
  2. git checkout -b/switch by any teammate but the lead — moves shared HEAD.
  3. Two teammates editing the same file — second write silently overwrites the first.
  4. git commit --amend — may rewrite a sibling’s commit; check ownership first (git log -1 --format='%H %an %s' + git reflog).
  5. Committing work you did not write — report it to the lead by path instead.
  6. git stash in any form without a pathspec (stash push, stash --keep-index, stash -u) — it is a reset --hard for every sibling. To prove a test RED, run it against git show HEAD:<file> in a temp copy, or stash ONLY your own paths: git stash push -- <your paths>.

Pathspec commit form: git commit -m "<msg>" -- path1 path2. New files: git add <explicit-paths> first. NEVER git add ./-A, git commit -a, or --amend. A pathspec guards which FILES land, not their CONTENT — read git diff --cached -- path1 path2 before every commit, or a sibling’s approved-but-uncommitted edit to the same file rides along silently. If that diff has more than you intended, say so in the message (name what came along and whose it looks like) or unstage it — never commit a diff your own subject line doesn’t cover.

Reviewing a shared-tree commit: a commit touching more than its author declared is normal here, not proof of a bug. Authority lives in commit messages, never in the diff — check the neighbouring commits (git log -1 --format=%B <sha>) for an authorization that already landed before calling anything a regression. A false regression report costs more than the sweep it “catches”: it reverts work someone else approved. These two obligations are one rule from both ends: a reviewer can only trust commit messages over diffs if committers actually declare what their commits contain.

Pathspec traps, pre-commit-formatter gotcha, read-only pinning, recovery, worktree recipes, incidents: skills/t1k-team/references/parallel-teammate-git-index-race.md, docs/parallel-teammate-git-index-race.md.