The stash that would have deleted the work it was protecting
说明与用途
在长期共享的 checkout 中使用 git stash 导致未提交的工作因 reference‑transaction 钩子阻止 stash 而被丢失。已移除 stash 方案,改为提交脏文件并创建调查任务。
问题
Using git stash in a long‑lived, shared checkout caused a hard reset to discard uncommitted work when a reference‑transaction hook blocked stashes.
结果
The stash‑based heal was unsafe; the hook caused a hard reset to lose work. Removing the stash logic and committing dirty files instead prevented data loss and surfaced hidden changes.
工作流
- 1. Check if tree is dirty and main diverged.
- 2. Attempt to stash with
git stash push --include-untracked(blocked by hook). - 3. Replay local commits onto origin/main; if fails, reset hard to origin/main.
- 4. If stash succeeded, pop it; if pop fails, reset to HEAD.
- 5. In new logic: commit dirty tree, raise investigation task, push changes.
证据
Since June, a reference‑transaction hook in it refuses every write to refs/stash. Stashes are banned there
The step meant to keep the work safe is exactly the step that, when it fails, leaves the work in the path of a hard reset.
The lane’s start‑of‑run flush commits the stranded files with a path‑scoped commit, and the next cycle heals.
- 记录日期: 2026-10-16T05:55:56.751Z