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 a single git working tree, a single index, AND a single HEAD. Two anti-patterns are BANNED:
- Two-step
git add+git commit— any teammate’sgit addaffects the shared index; a concurrentgit commitsweeps in files staged by another teammate (the first then commits an empty diff, losing work). git checkout -b(orswitch/checkout) from any teammate but the lead — moves sharedHEAD, so a sibling’s commits land on the wrong branch; recovery needs cherry-pick +git branch -f.
Use the pathspec commit form, and lead-allocated branches/worktrees:
# CORRECT — atomic, index-independent commitgit commit -m "<message>" -- path/to/file1 path/to/file2
# CORRECT — lead creates the branch BEFORE fan-out, then spawns; teammates only commitgit checkout -b feature-batch-x && git push -u origin feature-batch-x
# BANNED for teammates: git add . / -A, git commit -a, two-step add+commit,# git checkout/switch [-b] <branch>, git branch -fThe pathspec form bypasses the index (only named paths are snapshotted) — but git commit -- <newfile> fails on an untracked file, so new files need git add <explicit-paths> first (still race-safe: an explicit-path add is not a sweep). Pre-allocated branches mean teammates never move HEAD. Divergent branches → lead pre-creates a git worktree per teammate.
Full details
Section titled “Full details”Race mechanics, complete banned-pattern list, per-teammate-worktree recipe, pre-commit verification, narrow exceptions, HEAD-recovery, and the spawn-brief enforcement contract: docs/parallel-teammate-git-index-race.md.
Related
Section titled “Related”rules/parallelize-batch-work.md·rules/agent-completion-discipline.md·skills/t1k-team/SKILL.md§ “Spawn Brief — Mandatory Inclusions”