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

# Git Hook: Block Weak Code Before It Leaves Your Machine

> A pre-push hook that checks your project before every push and blocks the ones that fall below your threshold.

The pre-push hook runs in front of `git push`. If any file in your project scores below your threshold, the push is blocked and the offending files are listed.

Catching it here means nothing reaches the remote, so there is nothing to revert and no one else has to review it first.

<Note>
  The git pre-push hook requires **Iris Code Pro**.
</Note>

## Installing

Run **Iris Code: Install Git Hook** from the command palette. Iris Code writes `.git/hooks/pre-push` and makes it executable.

On first activation in a git repository, Iris Code also offers to install it for you. Declining is remembered per workspace, so you are not asked again.

## What happens on push

```bash theme={null}
$ git push origin main
Running pre-push hook (iris)...
Checking workspace against threshold 70...
✓ src/lib/utils.ts         92 / 100
✓ src/api/client.ts        78 / 100
✗ src/auth/session.ts      61 / 100
  → Hardcoded token-like value (line 42)
Push blocked — 1 file below threshold (70)
```

The hook resolves your project root, runs `iris check` using the bundled CLI, and either blocks with the list above or exits cleanly and allows the push.

## Configuring the threshold

Set `minHealthScore` in `.irisconfig.json` to control the minimum acceptable score. It defaults to 70.

```json theme={null}
{
  "minHealthScore": 80
}
```

On an established codebase, an absolute threshold can block a large share of the project from the first day, which usually ends with the hook being uninstalled. `gateBaselineMode` avoids that. Each existing file is judged against its own locked score, so the rule becomes "do not make this worse" rather than "fix everything first". New files still have to clear `minHealthScore`.

```json theme={null}
{
  "minHealthScore": 70,
  "gateBaselineMode": true
}
```

<Tip>
  An existing pre-push hook is left intact. Iris Code appends its own block between `# >>> iris-hook-start <<<` and `# >>> iris-hook-end <<<` markers, so anything already in the file continues to run.
</Tip>

## Insights tracking

Every hook run is recorded as a pass or fail in your account Insights, so enforcement activity is visible over time without reading terminal history. See [iriscode.co/account/insights](https://iriscode.co/account/insights).

## Uninstalling

Run **Iris Code: Uninstall Git Hook**. Only the Iris Code block between the markers is removed. If that leaves nothing but a shebang, the hook file is deleted.
