Skip to content

docs(git): never stash — the stack is shared repo-wide, park work as a wip commit (#14078) - #15037

Merged
mrveiss merged 4 commits into
Dev_new_guifrom
issue-14078-stash-doctrine
Aug 25, 2026
Merged

mrveiss merged 4 commits into
Dev_new_guifrom
issue-14078-stash-doctrine

Conversation

@mrveiss

@mrveiss mrveiss commented Aug 25, 2026 •

Copy link
Copy Markdown
Owner

Thinking Path

Ask 3 of #14078 — "stop the source" — was the only part of that umbrella still unaddressed after
its 18 rescued stashes were triaged. The umbrella's own wording: "Sessions should commit
incrementally on their own worktree branch instead of stashing, since the stack is shared. Worth a
line in the git/worktree developer doc."

The doc already had half of it. CLAUDE_GIT.md step 2 of the Pre-Flight Checklist says to read
git stash list and ask before proceeding if it is non-empty. What it never said is that you must
not write to the stack — which is the behaviour that produced 113 entries over three months. A
reader who follows the checklist literally learns to be careful about someone else's stash and
learns nothing about creating their own.

So the gap is a rule, not a warning: never stash, park work as a wip: commit on your own branch.
That also lines up with the surrounding protocol, which already tells sessions to leave nothing
uncommitted and to give WIP a wip: prefix — stashing is the one path that quietly opts out of
every ownership guarantee the worktree mandate provides.

I put it next to Branch Safety rather than inside the checklist because it is a standing prohibition
with a recovery procedure, not a per-task step, and the checklist entry now links to it so the
existing step gains the missing half without growing.

The recovery half matters as much as the prohibition. Someone will find a non-empty stack, and the
wrong instinct is to clear it. The section says what #14078 actually did: rescue each entry to a
branch, open an issue naming that branch, and drop only what is demonstrably present in base.
Without that, "never stash" reads as "so delete the ones you find".

What Changed

Verification

Model Used

Claude Opus 5 (1M context)

Refs #14078

@mrveiss

mrveiss commented Aug 25, 2026

Copy link
Copy Markdown
Owner Author

Review verdict: MERGE, with one MEDIUM finding I have fixed in this PR rather than deferring — because leaving it would have undermined the doctrine the PR exists to establish.

The contradiction. docs/developer/CLAUDE_WORKFLOW.md:118 said "Do NOT create/apply/drop git stash unless explicitly requested" — a conditional permission — while the new CLAUDE_GIT.md:91 says "Never git stash" unconditionally. Two docs disagreeing on whether stash is ever permitted is exactly the documentation-fork case: coverage unions, but conflicting claims resolve against reality, and reality here is #14078's 113 unowned entries, one of which was hiding a security fix. Replaced the conditional line with the absolute rule plus a cross-link to the canonical section.

Second, smaller fix. The git restore --staged --worktree prohibition was filed under "Never Stash" as "the same reason in miniature" — but it never touches refs/stash. It is a different destructive-discard risk: it resets your own index and worktree from HEAD. The prohibition is right; the stated mechanism was not. Now says what it actually does, and why to back files up first.

The core claim checks out. refs/stash is a single ref in the repository's common .git directory — unlike HEAD and the index, which git worktree add gives each worktree its own copy of. So every stash list/push/pop/drop/apply reads and writes the one shared stack from any linked worktree. The doctrine is accurate, which matters: an overstated rule gets disbelieved and ignored.

The alternative it offers is real too — the wip: convention it points at already exists at CLAUDE_WORKFLOW.md:98, and the recovery procedure mirrors what #14078's own triage actually did, verified against the 19 rescued/stash-* branches in this clone.

Refs #14078 is correct: this delivers ask 3 (document the rule). Asks 1 and 2 — the inventory and the per-entry disposition — were resolved outside this diff, with 17 of #14082–#14099 closed and #14087 open because it turned out to be a real security finding, now #15023.

New head f4bcc5e3c, 0 behind base.

@mrveiss
mrveiss merged commit 63c8486 into Dev_new_gui Aug 25, 2026
44 checks passed
@mrveiss
mrveiss deleted the issue-14078-stash-doctrine branch August 25, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant