> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blitzy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Merge

> Criteria for accepting and merging AI-generated pull requests

Merge when the generated code is ready for deployment. The PR meets quality standards, completes required functionality, and aligns with your project guide.

<Note>
  **Post-Code-Generation Options:** [Merge](#merge-criteria) (this page) | [Close](/pull-request-review/close) | [Refine PR](/pull-request-review/refine)

  **Choose Merge when:** The generated code meets quality standards with no critical gaps.
</Note>

## Merge Criteria

Apply this checklist to determine merge readiness:

| Criteria                     | Requirement                         |
| ---------------------------- | ----------------------------------- |
| **Critical gaps**            | Zero                                |
| **Major gaps**               | 3 or fewer (or refinement complete) |
| **Project guide completion** | 80% or higher                       |
| **Build status**             | Passing                             |
| **Tests**                    | Passing (if applicable)             |

**Gap Severity Definitions:**

* **Critical** - Security vulnerabilities, broken core functionality, data loss risks, architectural violations
* **Major** - Missing error handling, incomplete features, performance issues, inadequate testing
* **Minor** - Code style inconsistencies, documentation improvements, minor optimizations

## Decision Matrix

| Condition                               | Decision   |
| --------------------------------------- | ---------- |
| Zero critical gaps, minor gaps only     | **MERGE**  |
| Major gaps 3 or fewer, no critical gaps | **REFINE** |
| Critical gaps >0 OR fundamental issues  | **CLOSE**  |

## Review Process

<Steps>
  <Step title="Verify project guide completion">
    Check that the PR addresses requirements from your project guide:

    * Compare PR file changes against project guide requirements
    * Calculate completion: `(completed items / total items) x 100`
    * Verify 80% or higher completion threshold
    * Document any incomplete requirements

    For detailed verification steps, see [Project Guide Review](/project-lifecycle/project-guide-review).
  </Step>

  <Step title="Review PR documentation">
    Verify the PR includes:

    * Clear description of changes
    * Solution approach
    * Testing performed
    * Known limitations or follow-up work
    * Meaningful commit messages
  </Step>

  <Step title="Test locally">
    Validate the code in your local environment:

    ```bash theme={null}
    git fetch origin
    git checkout [branch-name]
    git pull origin [branch-name]
    # Install dependencies (npm install, etc.)
    # Run build
    # Run tests
    ```

    Verify build and tests pass without critical errors.
  </Step>

  <Step title="Assess code quality">
    Review generated code for:

    * Adherence to your codebase patterns
    * Proper error handling
    * Code style consistency
    * Integration with existing code
    * Performance considerations
  </Step>

  <Step title="Document gaps">
    Categorize any issues found:

    * **Critical** - blocks merge
    * **Major** - requires refinement if more than 3
    * **Minor** - acceptable

    If critical gaps exist, choose [Close](/pull-request-review/close). If major gaps exceed 3, choose [Refine](/pull-request-review/refine).
  </Step>
</Steps>

## Merge Conflicts

Select **Fix Merge Conflicts** from the Blitzy PR dropdown menu to resolve conflicts automatically. Blitzy rebases your branch and regenerates any conflicting sections while preserving the original intent.

## After Merging

Blitzy's context updates to include the merged changes. Start your next feature request, bug fix, or backlog item immediately.

## Projects with Submodules

Clicking **Merge PR** merges the parent repository only. Submodule changes are not merged automatically - merge each submodule separately in your source control tool.

<Warning>
  Do not close or merge submodule PRs until the main repository PR is fully merged and all Refine PR cycles are complete. Doing so can break active Refine PR jobs and leave your project in a state that requires manual recovery.
</Warning>

The correct merge order for multi-repo projects:

<Steps>
  <Step title="Complete all Refine PR cycles">
    Finish all refinement rounds on the main repository PR. Each Refine PR job reads from submodule branches - closing them prematurely causes build failures or silent regressions.
  </Step>

  <Step title="Merge the main repository PR">
    Merge the parent repo PR through Blitzy or your source control tool.
  </Step>

  <Step title="Merge submodule PRs">
    After the main PR is merged, merge each submodule PR in your source control tool. Then update the submodule pointers in the parent repo (see [Keeping Submodules Updated](/administration/submodules#keeping-submodules-updated)).
  </Step>
</Steps>

<CardGroup cols={2}>
  <Card title="Git Submodules" icon="code-branch" href="/administration/submodules">
    Configure and manage multi-repository projects
  </Card>

  <Card title="Project Guide Review" icon="clipboard-check" href="/project-lifecycle/project-guide-review">
    Verify completion before merging
  </Card>

  <Card title="Refine PR" icon="pen-to-square" href="/pull-request-review/refine">
    Request targeted modifications before merging
  </Card>

  <Card title="Close Pull Request" icon="circle-xmark" href="/pull-request-review/close">
    When to discard and restart
  </Card>
</CardGroup>
