Git rollback mode selector
Skill kjuhwa/skills-hub/skills/operations/git-rollback-mode-selector
Let operators pick how failed autonomous changes unwind — hard reset, stash-and-continue, or no-op — via one env var. The three modes trade audit-trail preservation against blast-radius containment.From its SKILL.md
npx -y skills add kjuhwa/skills-hub --skill git-rollback-mode-selectorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.7 KB, 499 tokens by cl100k_base, as published. Nobody here has run it
Git Rollback Mode Selector
Context
An autonomous process (codegen agent, evolver, migration runner) writes changes into a git worktree. When its own validation fails, you need to decide what happens to those changes. One env var, three modes:
| Mode | Behavior | Cost |
|---|---|---|
hard (default) | git reset --hard to pre-change HEAD; discard working tree & index | Fastest clean state; zero artifact of the failed attempt |
stash | git stash push --include-untracked the failed attempt; HEAD returns to pre-change state | Attempt is preserved for human review; stash accumulates if failures repeat |
none | Leave the tree as-is; log and abort the loop | Lets human inspect the exact failing state in place; next iteration blocked until cleanup |
Env var: EVOLVER_ROLLBACK_MODE={hard|stash|none}.
Rules
- Record the pre-change ref. Capture
git rev-parse HEADat the start of each iteration; that's the rollback target. Never trust "the previous commit" — the previous iteration may have already moved HEAD. - Include untracked.
hardmust alsogit clean -fd(scoped to the working dir, not recursively above it) or agents leave orphaned files.stashmust use--include-untracked. - Fail loud on
none. Whennoneis chosen and rollback is skipped, the loop must refuse to proceed until a human signals resume. Otherwise the next iteration runs on top of broken state. - Never
--forcepush automatically. Rollback is local-only. If the failed attempt was already pushed, open an issue / alert; do not rewrite remote history from an autonomous loop. - Tag the rollback in the audit log. Emit
{iteration_id, rollback_mode, pre_ref, post_ref, reason}to the event stream so you can reconstruct what happened even whenharderased the working tree.
Anti-patterns
- Using
git checkout .as the rollback — leaves untracked files and staged deletions. - Using
git stashwith no--include-untracked— same leak. - Rolling back across iterations (jumping past more than one pre-ref) — that's not rollback, that's revert; different operation, different semantics.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.