Rescue-Tag-Before-Destructive-Operation
Create and verify a recovery artifact before destructive state changes.
These examples and illustrative results are independently authored teaching materials, not measured model results.
Use case
An authorized teaching history rewrite has staged, unstaged and new files. A tag references a commit, not uncommitted data.
Mechanism
Record HEAD/branch and dirty-state inventory. Create a unique verified recovery ref without overwriting existing refs. Separately preserve index/worktree deltas and required new/ignored files with sizes/digests/restoration steps. Test restoration in an isolated checkout before the authorized destructive operation; insufficient backups leave original state intact.
Bad example
Create a rescue tag and assume uncommitted files, Git configuration and external data are all protected.
Good example
Bind a unique recovery ref to original HEAD and separately save staged/unstaged diffs and required new files. Reconcile the inventory and test recovery in a copy, declaring uncovered state. Recovery artifacts do not expand deletion permission.
Why the change matters
Commit refs and working files occupy different layers. Separate backups/restoration tests prevent returning to an old commit while losing current work.
Observable expectation
The teaching restoration copy has original HEAD, both deltas and new-file bytes/hashes. A correct tag with missing new files is incomplete. Rehearse in isolation, not by destructive cleanup in the original tree.
Limits
No frozen source is confirmed; this is an independent teaching construction. Refs/backups can fail or disappear, and secrets/external state/unlisted ignored files are not automatically protected. Backups do not grant destructive authority.
Sources and evidence
Source text has not been located. This method meets the editorial criteria; its examples are independent teaching constructions.
Read the editorial criteria