Br Rollback
Rollback a sprint or story — git revert + state update, safe and traceable
Claude CodeGeneric
---
name: br-rollback
description: "Rollback a sprint or story — git revert + state update, safe and traceable"
---
# BMAD-Ralph Rollback
Safely rollback stories or sprints using `git revert` (never `git reset --hard`).
## Arguments
- `$ARGUMENTS` = `story STORY-X.Y` → revert a specific story
- `$ARGUMENTS` = `sprint N` → revert all stories from sprint N
- `$ARGUMENTS` = `last` → revert the most recently completed story
- `$ARGUMENTS` empty → show what can be rolled back
## Pre-check
Read `.bmad-ralph/state.json`. If phase is before `EXECUTE`, say "Nothing to rollback yet."
## Show Rollback Options (no arguments)
List all completed stories with their commit hashes:
```bash
git log --oneline --grep="feat(sprint-"
Display:
AVAILABLE ROLLBACKS
─────────────────────────────────
[1] STORY-2.5 "Frontend integration" (latest)
[2] STORY-2.4 "API routes"
[3] STORY-2.3 "Auth middleware"
... (all completed stories)
[sprint 2] Rollback entire Sprint 2 (5 stories)
[sprint 1] Rollback entire Sprint 1 (6 stories)
Usage:
/project:br-rollback last
/project:br-rollback story STORY-2.3
/project:br-rollback sprint 2
Story Rollback
- Find the commit matching
feat(sprint-N): STORY-X.Yin git log - Show what will be reverted (files changed):
git show --stat <commit-hash> - Ask the user to confirm before proceeding
- Revert the commit:
git revert <commit-hash> --no-edit - Update
.bmad-ralph/state.json:- Remove story ID from
deliverables.implementations - Decrement
metrics.stories_completed - Update the sprint's
stories_completedcount - If this was the last story of a completed sprint, set sprint status back to
IN_PROGRESS
- Remove story ID from
- Log to
.bmad-ralph/logs/sprint-<N>.log:[<timestamp>] ROLLBACK: STORY-X.Y reverted - Display:
ROLLBACK COMPLETE ───────────────────────────────── Reverted: STORY-X.Y "<title>" Commit: <hash> → reverted by <new-hash> Files: 3 files restored The story is now available for re-execution. Run /project:br-build story STORY-X.Y to re-implement it.
Sprint Rollback
- Find ALL commits matching
feat(sprint-N): STORY-N.*in git log - Show summary of all stories and files that will be reverted
- Ask the user to confirm before proceeding
- Revert commits in reverse chronological order (most recent first):
git revert <hash-5> --no-edit git revert <hash-4> --no-edit git revert <hash-3> --no-edit ... - Update
.bmad-ralph/state.json:- Remove all sprint N story IDs from
deliverables.implementations - Reset sprint status to
PENDING - Set
current_sprintto N - Set
phasetoEXECUTE - Adjust
metrics.stories_completed
- Remove all sprint N story IDs from
- If a
bmad/sprint-Nbranch exists, note it but don't delete it - Display summary with count of reverted stories and files
Safety Rules
- NEVER use
git reset --hard— alwaysgit revertfor traceability - ALWAYS confirm with the user before reverting
- NEVER rollback past already-reviewed sprints without warning that the review is now invalid
- If there are uncommitted changes, warn and ask to stash first
- After rollback, the reverted stories become available for re-execution
Maintain Br Rollback?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Br Rollback on getagentictools](https://getagentictools.com/loops/franlao-bmad-ralph-rollback?ref=badge)