Abandon RALPH worktree without merging changes
Discard a RALPH worktree and all its changes without merging.
| Command | Description |
|---|---|
/ralph-discard |
Discard current/only worktree |
/ralph-discard {spec-name} |
Discard specific worktree |
/ralph-discard --force |
Skip confirmation prompt |
/ralph-discard --all |
Discard all RALPH worktrees |
/ralph-discardIf multiple worktrees exist:
? Which worktree do you want to discard?
β ralph/user-authentication (4 commits, 12 files)
β ralph/payment-integration (2 commits, 5 files)
β All worktrees
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Discard Warning β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β You are about to discard:
Worktree: .worktrees/user-authentication
Branch: ralph/user-authentication
This will permanently delete:
- 4 commits
- 12 files of work
- +342 lines of code
PRD progress will NOT be affected:
- prd.json will remain unchanged
- You can re-run /ralph-run to start fresh
This action CANNOT be undone.
? Are you sure you want to discard this worktree?
β Yes, discard all changes
β No, keep the worktree
β No, let me review first (/ralph-review)
# Remove worktree (force to handle uncommitted changes)
git worktree remove .worktrees/{spec-name} --force
# Delete the branch
git branch -D ralph/{spec-name}
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Worktree Discarded β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Removed worktree: .worktrees/user-authentication
β Deleted branch: ralph/user-authentication
The following changes were discarded:
- 4 commits
- 12 files
- +342 lines
Your main branch is unchanged.
Next steps:
- Run /ralph-run to start fresh implementation
- Run /ralph to check PRD status
With /ralph-discard --all:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Discard All Worktrees β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β You are about to discard ALL RALPH worktrees:
1. ralph/user-authentication
- 4 commits, 12 files
2. ralph/payment-integration
- 2 commits, 5 files
Total: 6 commits, 17 files will be lost.
? Proceed with discarding all worktrees?
β Yes, discard everything
β No, let me choose specific worktrees
β Cancel
With --force, skip confirmation:
# Used for automated cleanup or when you're certain
/ralph-discard --force
# Or for specific worktree
/ralph-discard user-authentication --force
Output:
β Force discarded: ralph/user-authentication
If the worktree has uncommitted changes:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Uncommitted Changes β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β This worktree has uncommitted changes:
Modified:
~ src/services/user.service.ts
~ tests/services/user.service.test.ts
Untracked:
+ src/utils/temp.ts
? How do you want to proceed?
β Discard everything (including uncommitted)
β Commit changes first, then discard
β Cancel and review changes
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Recovery Information β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
If you accidentally discarded a worktree, you may be able to recover
commits using git reflog (within 30 days):
git reflog
git checkout -b recovered {commit-hash}
However, uncommitted changes CANNOT be recovered.
| Error | Action |
|---|---|
| No worktrees | Inform user, nothing to discard |
| Worktree not found | List available worktrees |
| Permission denied | Suggest --force flag |
| Branch in use | Checkout different branch first |
Before discarding: