From 0f90003d15d564d1692fc3fdc60b2bf231181059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Sun, 23 Aug 2026 18:12:18 +0000 Subject: [PATCH] convention: commit by path, not by index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `git add ` then a bare `git commit` commits the whole index, so a concurrent session's staged work rides along under your message and your session trailer. Two agents share this tree most nights and it happened tonight — 6e092c32 names one file and holds ten. `git commit -- ` is the form that does what the two-step version looks like it does. Note the argument order: -m or -F comes BEFORE the --, or git reads the message as a pathspec. Co-Authored-By: Claude Opus 5 Officer-Session: 656f5c85-e49a-4f1f-b9f3-042a04b4d043 --- CLAUDE.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 13878549..6809dbb9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -361,6 +361,17 @@ withholding the commit until it is good. Commit messages: simple lowercase, no prefixes. +**Stage and commit in ONE step, naming the paths.** `git add ` then a bare `git commit` commits the +whole **index**, not the path just named — so anything a concurrent session had staged goes into your +commit, under your message and your session trailer. Use `git commit -- ` instead, which does what +the two-step form only looks like it does. + +This is not hypothetical and it is not rare: two agents share this working tree most nights. On +2026-08-23 commit `6e092c32` says "marketplace: minesweeper in the catalogue" and contains nine files of +another session's roles work, swept up mid-`git add`. The other session was right not to amend it — +rewriting shared history to fix a message is the worse trade — so the record was corrected with a +follow-up note instead. Cheap to avoid, awkward to undo. + **An agent's commit names the session that made it.** A trailer, below `Co-Authored-By`: ```