Skip to content

Commit 6186ee4

Browse files
committed
chore(claude): document "don't revert files you didn't touch"
When `git status` shows files you didn't modify (other session's edits, hook side-effects, upstream pulls), leave them alone. Don't `git checkout -- <unrelated-path>` to clean up the diff before committing, and don't sweep them into `git add`. Stage only the files you explicitly edited. Codifies a pattern that's easy to violate when chasing "clean diffs" on commit but actively destroys work belonging to parallel sessions. Sits alongside the existing parallel-sessions / worktree-required rules. Synced from socket-lib's canonical PARALLEL CLAUDE SESSIONS section.
1 parent a7bdc11 commit 6186ee4

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
- **REQUIRED for staging**: surgical `git add <specific-file> [<file>…]` with explicit paths. Never `-A` / `.`.
3131
- **If you need a quick WIP save**: commit on a new branch from inside a worktree, not a stash.
32+
- **NEVER revert files you didn't touch.** If `git status` shows files you didn't modify, those belong to another session, an upstream pull, or a hook side-effect — leave them alone. Specifically: do not run `git checkout -- <unrelated-path>` to "clean up" the diff before committing, and do not include unrelated paths in `git add`. Stage only the explicit files you edited.
3233

3334
The umbrella rule: never run a git command that mutates state belonging to a path other than the file you just edited.
3435

0 commit comments

Comments
 (0)