Private
Public Access
2.1 KiB
2.1 KiB
git restore, git checkout -- , and git reset are forbidden without explicit user permission
From AGENTS.md "Critical Anti-Patterns" HARD BAN:
- HARD BAN:
git restore,git checkout -- <file>,git resetare FORBIDDEN without explicit user permission in the same message. They destroyed user in-progress src/* edits twice in one session (2026-06-07). If you think you need one, ASK FIRST. - HARD BAN:
git stash*(any form:git stash,git stash pop,git stash apply,git stash drop,git stash clear) is FORBIDDEN. Stashing inverts the safety net of the working tree: agit add .thengit stashthen "fresh start" pattern is exactly how Tier 2 corrupted files in the 2026-06-27cruft_elimination_20260627track. The user explicitly stated "I hate when people fuck with my commits" — stashing throws away the user's in-progress edits silently. If you think you need a stash, you don't — use a NEW BRANCH or a WORKTREE instead. Tier 2 sandbox enforces this viaconductor/tier2/opencode.json.fragmentbash deny rules.
From conductor/workflow.md §"Known Pitfalls (2026-06-05)" §"HARD BAN":
Per AGENTS.md (Critical Anti-Patterns): These three commands are FORBIDDEN without explicit user permission in the same message. They destroyed user in-progress src/* edits twice in one session (2026-06-07). If you think you need one, ASK FIRST.
The intent of "look at what the file looked like at commit X" is non-destructive inspection. The CORRECT way:
# WRONG: overwrites the working tree
git checkout HEAD~1 -- src/foo.py
# RIGHT: prints to stdout, leaves working tree alone
git show HEAD~1:src/foo.py
git checkout -- <file> and git restore are particularly dangerous because:
- They overwrite uncommitted changes silently
- They overwrite previously-committed state in the working tree if the user has already committed and then re-edited
- The user doesn't see the loss until they notice missing changes
If you genuinely need to revert (e.g., the working tree is broken from a previous agent), use git stash first to capture the in-progress state, ASK THE USER, then proceed.