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

# Install git hooks

> Check staged changes against your policies locally, before they leave your machine.

MergeGuide git hooks run a policy check at commit and push time, so violations are
caught on your machine before they reach a pull request. The CLI installs and
manages the hooks for you.

<Note>
  **Prerequisite:** the [MergeGuide CLI](/install/cli), installed and authenticated.
</Note>

## Install

```bash theme={null}
mergeguide hooks install
```

By default this installs the standard set of hooks for the current repository. To
install a specific hook type:

```bash theme={null}
mergeguide hooks install --hook-type pre-commit
```

Supported hook types are `pre-commit`, `pre-push`, `commit-msg`, `post-commit`,
and `all`.

<Tip>
  If you ran [`mergeguide init`](/get-started/quickstart), git hooks were already
  installed for you.
</Tip>

## Check status

```bash theme={null}
mergeguide hooks status
```

## Fleet install

To install hooks across every git repository under a directory:

```bash theme={null}
mergeguide hooks install --all /path/to/repos --dry-run
```

`--dry-run` reports what would happen without writing anything. Drop it to apply.
Use `--max-depth` to bound how deep the repo discovery recurses (default 5).

## What happens on commit

When you commit, the hook runs MergeGuide against your staged changes:

* If there are no blocking findings, the commit proceeds.
* If there are blocking findings, the commit is stopped and the findings are
  printed so you can fix them.

Bypasses are recorded. You can review the audit log of hook bypasses at any time:

```bash theme={null}
mergeguide hooks bypasses
```

## Remove the hooks

```bash theme={null}
mergeguide hooks uninstall
```

## Next steps

<CardGroup cols={2}>
  <Card title="Set up the PR gate" icon="code-pull-request" href="/install/pr-gate">
    Enforce policy on pull requests across your SCM.
  </Card>

  <Card title="Configuration" icon="sliders" href="/configuration/mergeguide-yaml">
    Tune which policies run and your fail thresholds.
  </Card>
</CardGroup>
