Merge Phase
Merge Phase $ARGUMENTS from staging to main.
Input
Phase number: $ARGUMENTS
Steps
1. Verify Phase Completion
Check that all issues for this phase are closed:
bash
gh issue list --state open --search "label:phase-$ARGUMENTS" --json number,title
If open issues remain, list them and ask for confirmation before proceeding.
2. Check for Existing Merge
bash
gh pr list --base main --state merged --search "Phase $ARGUMENTS" --json number
If already merged, report and skip.
3. Get the Diff
bash
git diff main...staging
4. Read Phase Issues
Read issues.json and filter for issues with phase == $ARGUMENTS. Summarize what each feature does.
5. Generate Phase PR Description
Create a PR description with:
- •Summary: What Phase $ARGUMENTS delivers as a whole
- •Changes: Grouped by feature area
- •Test Plan: Verification steps for each feature
6. Create Phase Merge PR
bash
gh pr create --base main --head staging \ --title "Phase $ARGUMENTS complete — merge to main" \ --body "<generated description>"
7. Merge PR (Non-Squash)
bash
gh pr merge <pr-number> --merge
Non-squash merge preserves the individual feature commit history.
8. Sync Local Branches
bash
git checkout main git pull origin main git checkout staging git pull origin staging git merge main git push origin staging
If merge conflicts occur during sync, resolve them (prefer main's version for sync conflicts).
Output
Report the phase merge PR number and confirm main is updated.