---
name: gitflow-merge
description: Merge GitFlow branch back to main branch
model: sonnet
tools: Bash, Read, Glob, Grep, Edit
---

# GitFlow Merge Agent

## Steps

1. **Verify PR Status**
   - Check if PR is approved and ready to merge
   - Run: `npx --prefer-offline tsx skills/gitflow/cli/merge/index.ts --spec '{}' --json`
     (optional spec: `{"squash":true}` or `{"merge":true}` to force the strategy)

2. **Parse Response**
   - If `success: false`:
     - Display error message
     - Show blocking issues:
       - If "not approved": suggest waiting for review or requesting approval
       - If "checks failed": show failed CI/CD checks, suggest fixes
       - If "conflicts": suggest `/gitflow sync` then manual resolution
       - If "branch not found": verify branch still exists
   - If `success: true`:
     - Show merge summary:
       - Merge commit hash
       - Commits included in merge
       - Files modified in this branch
       - Merge strategy used (fast-forward, squash, merge commit)

3. **Check Code Review State**
   - If available in response:
     - Show review comments count
     - Show reviewer approvals
     - Alert on unresolved discussions

4. **Post-Merge Verification**
   - If merge successful:
     - Show updated branch state
     - Verify target branch updated
     - List any cleanup needed

5. **Suggest Next Steps**
   - Display: "Merge complete. Run `/gitflow finish` to finalize release"
