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

# Block Merge

> Prevent pull requests from merging with unresolved findings

export const ThemeImage = ({src, alt}) => {
  let lightSrc, darkSrc;
  if (src.includes("-light.")) {
    lightSrc = src;
    darkSrc = src.replace("-light.", "-dark.");
  } else if (src.includes("-dark.")) {
    darkSrc = src;
    lightSrc = src.replace("-dark.", "-light.");
  } else {
    lightSrc = src;
    darkSrc = src;
  }
  return <span>
      <img className="block dark:hidden rounded-lg border" src={lightSrc} alt={alt} />
      <img className="hidden dark:block rounded-lg border" src={darkSrc} alt={alt} />
    </span>;
};

## Overview

Gitar can prevent a PR from being merged when its code review finds issues above a severity threshold you configure. It uses your platform's native review mechanism — requesting changes on GitHub or unapproving on GitLab — so the block integrates with your existing branch protection rules.

## How It Works

<Steps>
  <Step title="Code review completes">
    Gitar reviews the PR as usual, producing a verdict based on the findings.
  </Step>

  <Step title="Verdict is evaluated against the threshold">
    If the verdict meets or exceeds your configured blocking level, Gitar submits a blocking review on the PR.
  </Step>

  <Step title="Issues are resolved">
    As you push fixes and findings are resolved, Gitar re-evaluates the verdict. Once it drops below the threshold, Gitar dismisses its blocking review and the PR can merge.
  </Step>
</Steps>

<ThemeImage src="/assets/images/merge-blocking-light.png" alt="Gitar blocking a PR merge due to unresolved code review findings" border={true} />

## Enabling Block Merge

1. Navigate to **Settings** in the Gitar dashboard
2. Open the **Code Review** section
3. Enable **Block merge based on code review**
4. Select your desired blocking level

## Platform Behavior

<AccordionGroup>
  <Accordion title="GitHub">
    Gitar submits a "request changes" review on the PR. If your branch protection rules require approving reviews or no outstanding change requests, this blocks the merge button.

    When the block is lifted, Gitar dismisses its review. Repository admins can also dismiss the blocking review manually through GitHub's UI — Gitar respects this override and will not re-block for the current review cycle.
  </Accordion>

  <Accordion title="GitLab">
    Gitar adds itself as a reviewer and withholds approval. If your approval rules require Gitar's approval, the MR cannot merge until the block is lifted.

    When issues are resolved, Gitar approves the MR to unblock it.
  </Accordion>
</AccordionGroup>

## Overriding a Block

If you need to merge despite unresolved findings, you have two options:

* **[`gitar unblock`](/commands#unblock) command** — Comment `gitar unblock` on the PR to dismiss the blocking review and allow merging.
* **Platform override** — Dismiss the blocking review directly through GitHub or GitLab's native UI.
