--- name: stash-supersession-audit-before-drop description: "Before dropping a stale git stash, prove it's superseded by HEAD via per-file line-set diff of git show stash@{0}:file vs HEAD; archive as an annotated tag and drop only after auditing unique facts — zero-loss alternative to blind drop." --- # Stash Supersession Audit Before Drop Use when a repo (especially a live-deployment checkout where the working tree IS the deployment, e.g. `~/.omp` command-center) has an old stash whose content may have been superseded by later commits, and dropping blindly risks losing unique facts. ## Procedure 1. **Inventory the stash** — see which files it touches: ```bash git stash show --stat stash@{0} ``` 2. **Probe for unique content per file.** For each touched file, diff stash version against HEAD and count lines that exist only in the stash version: ```bash git show "stash@{0}:" > /tmp/stash_copy # compare normalized line sets; report lines present in stash but absent from HEAD ``` A file with `unique-vs-HEAD = 0` is fully superseded — safe to drop for that file. 3. **Classify each unique-content hit**: - *Stale fact* (superseded by a later refactor, e.g. old model/provider naming) → drop is correct. - *Live durable fact* (e.g. an operational invariant never re-recorded) → extract it into the live memory/docs file or flag to the user before dropping. 4. **Archive before dropping** — zero-loss: tag the stash commit, then drop from the stash list: ```bash git tag archive/stash---wip "stash@{0}" git stash drop "stash@{0}" ``` The tag pins the full stash object (including its index parent); recoverable later via `git show archive/stash-...` or `git checkout archive/stash-...^3 -- ` for the untracked-files third parent if present. ## Why Stashes are invisible in normal history and expire from reflogs (~90 days). A stash that *looks* superseded can still hold the only copy of a durable fact; tagging converts "drop" into a reversible archive with zero workflow cost.