Committing when not the only writer: stage a new file by exact name first - #35
Merged
Merged
Conversation
…ct name first Fixes a defect in "Committing when you are not the only writer". The prescribed `git commit -- <paths>` refuses a file git has never seen, and the natural recovery (git add, then a plain commit) is the pattern the section forbids. Both recorded sweeps happened on new files. The fix: stage your own new files by exact name, then commit with the same paths. Also: never stage by directory in a shared repo (`git add -A <dir>` takes other sessions' untracked files), and, marked optional on one sighting, read `git log origin/<branch>..HEAD` before pushing from a shared clone. Petition: claude-notes briefings/petition-carry-forward-2026-09-24b.md item 4; approved by Jones 2026-09-24. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The section's remedy for a shared index,
git commit -m "..." -- <paths>, fails on a file git has never seen (pathspec ... did not match any file(s) known to git). A new file is the commonest commit in a notebook repository, and the natural recovery,git addthen a plain commit, is the exact pattern the section forbids. Staging your own new file by exact name and then committing with the same paths works, and still leaves another session's staged files out (verified in a scratch repository on 2026-09-24). Staging by directory does not:git add -A <dir>takes other sessions' untracked files, because a path scope cannot express authorship.Sightings
Two independent sweeps (2026-09-07 and 2026-09-24), each committing another session's new file under the wrong message. Both broke a rule the standard already states, so this is filed as a defect in the remedy, not a new rule; one sighting suffices. The closing push sentence rests on one sighting and is marked optional in the text itself.
What changes
Approved by Jones on 2026-09-24. Drafted in claude-notes:
briefings/petition-carry-forward-2026-09-24b.mditem 4.🤖 Generated with Claude Code