name: magic-finish-branch description: Finish a development branch — verify tests, merge/PR/cleanup.
Verify Tests
Run full test suite. If tests fail: STOP, fix before proceeding.
Report:
- Test command and result
- All passing? Any skipped?
Present Options
Ask the user which option they prefer:
- Merge back to main locally
- Push and create a Pull Request
- Keep the branch as-is
- Discard this work
Execute Choice
Option 1 (Merge):
git checkout main
git pull origin main
git merge <branch-name>
git branch -d <branch-name>
Option 2 (PR):
git push -u origin <branch-name>
gh pr create --fill
If gh is not available, provide the GitHub URL for manual PR creation.
Option 3 (Keep): Report branch location, keep worktree if applicable.
Option 4 (Discard): Require the user to type "discard" to confirm.
git checkout main
git branch -D <branch-name>
Cleanup
Remove worktree if applicable (Options 1, 2, 4 only):
git worktree remove .worktrees/<branch-name>
Report final state: current branch, worktree status, remaining cleanup.