templates/global/skills/ralph-merge/SKILL.md
Merge completed RALPH worktree changes to main branch
npx skillsauth add doravidan/supreme-ralph ralph-mergeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Merge completed RALPH worktree changes back to the main branch.
| Command | Description |
|---------|-------------|
| /ralph-merge | Merge current worktree to main |
| /ralph-merge {spec-name} | Merge specific worktree |
| /ralph-merge --squash | Squash all commits into one |
| /ralph-merge --dry-run | Show what would be merged |
/ralph-merge# Check for worktrees
WORKTREES=$(git worktree list --porcelain | grep -c "^worktree" || echo "0")
if [ "$WORKTREES" -le 1 ]; then
echo "❌ No RALPH worktrees found"
echo "Run /ralph-run first to create a worktree"
exit 1
fi
# List available worktrees
echo "Available RALPH worktrees:"
git worktree list | grep "ralph/"
If multiple worktrees exist, use AskUserQuestion:
? Which worktree do you want to merge?
○ ralph/user-authentication (4 commits, 12 files)
○ ralph/payment-integration (2 commits, 5 files)
○ Cancel
Show summary of changes to be merged:
╔════════════════════════════════════════════════════════════════╗
║ Merge Preview ║
╚════════════════════════════════════════════════════════════════╝
Worktree: .worktrees/user-authentication
Branch: ralph/user-authentication
Target: main
Commits to merge: 4
abc1234 feat: ST-001-1 - Create User type definitions
def5678 feat: ST-001-2 - Create Zod validation schema
ghi9012 feat: ST-001-3 - Create User service layer
jkl3456 feat: ST-001-4 - Add unit tests
Files changed: 12
src/types/user.ts (new)
src/types/index.ts (modified)
src/schemas/user.schema.ts (new)
src/services/user.service.ts (new)
...
Diff stats:
+342 lines added
-12 lines removed
? Proceed with merge?
○ Yes, merge to main (Recommended)
○ Yes, squash merge (combine all commits)
○ No, review changes first (/ralph-review)
○ No, abandon changes (/ralph-discard)
# Save current branch
CURRENT=$(git rev-parse --abbrev-ref HEAD)
# Checkout main
git checkout main
# Merge worktree branch (--no-ff preserves history)
git merge ralph/{spec-name} --no-ff -m "feat: Implement {spec-name}
Merged from RALPH worktree:
- {summary of changes}
Stories completed:
- US-001: {title}
- US-002: {title}
Co-Authored-By: RALPH <[email protected]>"
# Remove worktree
git worktree remove .worktrees/{spec-name} --force
# Delete branch
git branch -d ralph/{spec-name}
╔════════════════════════════════════════════════════════════════╗
║ Merge Complete ║
╚════════════════════════════════════════════════════════════════╝
✓ Merged ralph/user-authentication into main
✓ Removed worktree: .worktrees/user-authentication
✓ Deleted branch: ralph/user-authentication
Commits merged: 4
Files changed: 12
Current branch: main
Next steps:
- Run tests: npm test
- Push to remote: git push origin main
With --squash, all commits are combined:
git checkout main
git merge ralph/{spec-name} --squash
git commit -m "feat: Implement {spec-name}
Combined from 4 commits in RALPH worktree.
Changes:
- Created User type definitions
- Added Zod validation schema
- Implemented User service layer
- Added unit tests
Co-Authored-By: RALPH <[email protected]>"
| Error | Action |
|-------|--------|
| Merge conflicts | Show conflict files, offer resolution |
| No worktrees | Direct to /ralph-run |
| Tests fail post-merge | Warn user, suggest /ralph-qa |
| Branch already deleted | Skip branch deletion |
If conflicts occur:
╔════════════════════════════════════════════════════════════════╗
║ Merge Conflicts ║
╚════════════════════════════════════════════════════════════════╝
Conflicts in 2 files:
✗ src/types/index.ts
✗ src/services/auth.service.ts
Options:
1. Resolve conflicts now (I'll help)
2. Abort merge (keep worktree)
3. Accept theirs (worktree version)
4. Accept ours (main version)
Use AskUserQuestion to determine resolution strategy.
development
Run RALPH autonomous development loop. Converts PRD markdown to prd.json and runs autonomous implementation.
development
Run RALPH autonomous development loop to implement features from the PRD.
documentation
Generate detailed Product Requirements Documents (PRDs) through interactive conversation.
development
Initialize any project with Claude Code best practices and RALPH autonomous development