agentsclimarketplace

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

Install
npx -y skills add kjuhwa/skills-hub --skill git-rollback-mode-selector

Assembled 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:

ModeBehaviorCost
hard (default)git reset --hard to pre-change HEAD; discard working tree & indexFastest clean state; zero artifact of the failed attempt
stashgit stash push --include-untracked the failed attempt; HEAD returns to pre-change stateAttempt is preserved for human review; stash accumulates if failures repeat
noneLeave the tree as-is; log and abort the loopLets 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 HEAD at 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. hard must also git clean -fd (scoped to the working dir, not recursively above it) or agents leave orphaned files. stash must use --include-untracked.
  • Fail loud on none. When none is 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 --force push 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 when hard erased the working tree.

Anti-patterns

  • Using git checkout . as the rollback — leaves untracked files and staged deletions.
  • Using git stash with 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.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.