# CLI Reference

## prek

A Git hook manager written in Rust, designed as a drop-in alternative to pre-commit.

### Usage

```text
prek [OPTIONS] [HOOK|PROJECT]... [COMMAND]
```

### Commands

[`prek install`](#prek-install) : Install prek Git shims into Git's effective hooks directory

[`prek prepare-hooks`](#prek-prepare-hooks) : Prepare environments for all hooks used in the config file

[`prek run`](#prek-run) : Run hooks

[`prek list`](#prek-list) : List hooks configured in the current workspace

[`prek uninstall`](#prek-uninstall) : Uninstall prek Git shims

[`prek validate-config`](#prek-validate-config) : Validate configuration files (prek.toml or .pre-commit-config.yaml)

[`prek validate-manifest`](#prek-validate-manifest) : Validate `.pre-commit-hooks.yaml` files

[`prek sample-config`](#prek-sample-config) : Produce a sample configuration file (prek.toml or .pre-commit-config.yaml)

[`prek auto-update`](#prek-auto-update) : Auto-update the `rev` field of repositories in the config file to the latest version

[`prek cache`](#prek-cache) : Manage the prek cache

[`prek try-repo`](#prek-try-repo) : Try the pre-commit hooks in the current repo

[`prek util`](#prek-util) : Utility commands

[`prek self`](#prek-self) : `prek` self management

## prek install

Install prek Git shims into Git's effective hooks directory.

By default this is `.git/hooks/`, but repo-local or worktree-local `core.hooksPath` is honored when set.

The Git shims installed by this command are determined by `--hook-type` or `default_install_hook_types` in the config file, falling back to `pre-commit` when neither is set.

A hook's `stages` field does not affect which Git shims this command installs.

### Usage

```text
prek install [OPTIONS] [HOOK|PROJECT]...
```

### Arguments

[`HOOK|PROJECT`](#prek-install--includes) : Include the specified hooks or projects.

```
Supports flexible selector syntax:

- `hook-id`: Run all hooks with the specified ID across all projects
- `project-path/`: Run all hooks from the specified project
- `project-path:hook-id`: Run only the specified hook from the specified project

Can be specified multiple times to select multiple hooks/projects.
```

### Options

[`--allow-missing-config`](#prek-install--allow-missing-config) : Allow a missing configuration file

[`--cd`](#prek-install--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-install--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-install--config), `-c` *config* : Path to alternate config file

[`--git-dir`](#prek-install--git-dir) *git-dir* : Install Git shims into the `hooks` subdirectory of the given git directory (`<GIT_DIR>/hooks/`).

```
When this flag is used, `prek install` bypasses the safety check that normally refuses to install shims while `core.hooksPath` is configured outside the repo. It only writes shims to `<GIT_DIR>/hooks`; Git will keep using `core.hooksPath` until that config changes.
```

[`--help`](#prek-install--help), `-h` : Display the concise help for this command

[`--hook-type`](#prek-install--hook-type), `-t` *hook-type* : Which Git shim(s) to install.

```
Specifies which Git hook type(s) you want to install shims for. Can be specified multiple times to install shims for multiple hook types.

If not specified, uses `default_install_hook_types` from the config file, or defaults to `pre-commit` if that is also not set.

Note: This is different from a hook's `stages` parameter in the config file, which declares which stages a hook *can* run in.

Possible values:

- `commit-msg`
- `post-checkout`
- `post-commit`
- `post-merge`
- `post-rewrite`
- `pre-commit`
- `pre-merge-commit`
- `pre-push`
- `pre-rebase`
- `prepare-commit-msg`
```

[`--log-file`](#prek-install--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-install--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--overwrite`](#prek-install--overwrite), `-f` : Overwrite existing Git shims

[`--prepare-hooks`](#prek-install--prepare-hooks), `--install-hooks` : Also prepare environments for all hooks used in the config file

[`--quiet`](#prek-install--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-install--refresh) : Refresh all cached data

[`--skip`](#prek-install--skip) *hook|project* : Skip the specified hooks or projects.

```
Supports flexible selector syntax:

- `hook-id`: Skip all hooks with the specified ID across all projects
- `project-path/`: Skip all hooks from the specified project
- `project-path:hook-id`: Skip only the specified hook from the specified project

Can be specified multiple times. Also accepts `PREK_SKIP` or `SKIP` environment variables (comma-delimited).
```

[`--verbose`](#prek-install--verbose), `-v` : Use verbose output

[`--version`](#prek-install--version), `-V` : Display the prek version

## prek prepare-hooks

Prepare environments for all hooks used in the config file.

This command does not install Git shims. To install the Git shims along with the hook environments in one command, use `prek install --prepare-hooks`.

### Usage

```text
prek prepare-hooks [OPTIONS] [HOOK|PROJECT]...
```

### Arguments

[`HOOK|PROJECT`](#prek-prepare-hooks--includes) : Include the specified hooks or projects.

```
Supports flexible selector syntax:

- `hook-id`: Run all hooks with the specified ID across all projects
- `project-path/`: Run all hooks from the specified project
- `project-path:hook-id`: Run only the specified hook from the specified project

Can be specified multiple times to select multiple hooks/projects.
```

### Options

[`--cd`](#prek-prepare-hooks--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-prepare-hooks--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-prepare-hooks--config), `-c` *config* : Path to alternate config file

[`--help`](#prek-prepare-hooks--help), `-h` : Display the concise help for this command

[`--log-file`](#prek-prepare-hooks--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-prepare-hooks--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--quiet`](#prek-prepare-hooks--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-prepare-hooks--refresh) : Refresh all cached data

[`--skip`](#prek-prepare-hooks--skip) *hook|project* : Skip the specified hooks or projects.

```
Supports flexible selector syntax:

- `hook-id`: Skip all hooks with the specified ID across all projects
- `project-path/`: Skip all hooks from the specified project
- `project-path:hook-id`: Skip only the specified hook from the specified project

Can be specified multiple times. Also accepts `PREK_SKIP` or `SKIP` environment variables (comma-delimited).
```

[`--verbose`](#prek-prepare-hooks--verbose), `-v` : Use verbose output

[`--version`](#prek-prepare-hooks--version), `-V` : Display the prek version

## prek run

Run hooks

### Usage

```text
prek run [OPTIONS] [HOOK|PROJECT]...
```

### Arguments

[`HOOK|PROJECT`](#prek-run--includes) : Include the specified hooks or projects.

```
Supports flexible selector syntax:

- `hook-id`: Run all hooks with the specified ID across all projects
- `project-path/`: Run all hooks from the specified project
- `project-path:hook-id`: Run only the specified hook from the specified project

Can be specified multiple times to select multiple hooks/projects.
```

### Options

[`--all-files`](#prek-run--all-files), `-a` : Run on all files in the repo

[`--cd`](#prek-run--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-run--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-run--config), `-c` *config* : Path to alternate config file

[`--directory`](#prek-run--directory), `-d` *dir* : Run hooks on all files in the specified directories.

```
You can specify multiple directories. It can be used in conjunction with `--files`.
```

[`--dry-run`](#prek-run--dry-run) : Do not run the hooks, but print the hooks that would have been run

[`--fail-fast`](#prek-run--fail-fast) : Stop running hooks after the first failure

[`--files`](#prek-run--files) *files* : Specific filenames to run hooks on

[`--from-ref`](#prek-run--from-ref), `--source`, `-s` *from-ref* : The original ref in a `<from_ref>...<to_ref>` diff expression. Files changed in this diff will be run through the hooks

[`--help`](#prek-run--help), `-h` : Display the concise help for this command

[`--last-commit`](#prek-run--last-commit) : Run hooks against the last commit. Equivalent to `--from-ref HEAD~1 --to-ref HEAD`

[`--log-file`](#prek-run--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-run--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--quiet`](#prek-run--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-run--refresh) : Refresh all cached data

[`--show-diff-on-failure`](#prek-run--show-diff-on-failure) : When hooks fail, run `git diff` directly afterward

[`--skip`](#prek-run--skip) *hook|project* : Skip the specified hooks or projects.

```
Supports flexible selector syntax:

- `hook-id`: Skip all hooks with the specified ID across all projects
- `project-path/`: Skip all hooks from the specified project
- `project-path:hook-id`: Skip only the specified hook from the specified project

Can be specified multiple times. Also accepts `PREK_SKIP` or `SKIP` environment variables (comma-delimited).
```

[`--stage`](#prek-run--stage), `--hook-stage` *stage* : The stage during which the hook is fired.

```
When specified, only hooks configured for that stage (for example `manual`, `pre-commit`, or `pre-push`) will run. Defaults to `pre-commit` if not specified. For hooks specified directly in the command line, fallback to `manual` stage if no hooks found for `pre-commit` stage.

Possible values:

- `manual`
- `commit-msg`
- `post-checkout`
- `post-commit`
- `post-merge`
- `post-rewrite`
- `pre-commit`
- `pre-merge-commit`
- `pre-push`
- `pre-rebase`
- `prepare-commit-msg`
```

[`--to-ref`](#prek-run--to-ref), `--origin`, `-o` *to-ref* : The destination ref in a `from_ref...to_ref` diff expression. Defaults to `HEAD` if `from_ref` is specified

[`--verbose`](#prek-run--verbose), `-v` : Use verbose output

[`--version`](#prek-run--version), `-V` : Display the prek version

## prek list

List hooks configured in the current workspace

### Usage

```text
prek list [OPTIONS] [HOOK|PROJECT]...
```

### Arguments

[`HOOK|PROJECT`](#prek-list--includes) : Include the specified hooks or projects.

```
Supports flexible selector syntax:

- `hook-id`: Run all hooks with the specified ID across all projects
- `project-path/`: Run all hooks from the specified project
- `project-path:hook-id`: Run only the specified hook from the specified project

Can be specified multiple times to select multiple hooks/projects.
```

### Options

[`--cd`](#prek-list--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-list--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-list--config), `-c` *config* : Path to alternate config file

[`--help`](#prek-list--help), `-h` : Display the concise help for this command

[`--hook-stage`](#prek-list--hook-stage) *hook-stage* : Show only hooks that has the specified stage

```
Possible values:

- `manual`
- `commit-msg`
- `post-checkout`
- `post-commit`
- `post-merge`
- `post-rewrite`
- `pre-commit`
- `pre-merge-commit`
- `pre-push`
- `pre-rebase`
- `prepare-commit-msg`
```

[`--language`](#prek-list--language) *language* : Show only hooks that are implemented in the specified language

```
Possible values:

- `bun`
- `conda`
- `coursier`
- `dart`
- `deno`
- `docker`
- `docker-image`
- `dotnet`
- `fail`
- `golang`
- `haskell`
- `julia`
- `lua`
- `node`
- `perl`
- `pygrep`
- `python`
- `r`
- `ruby`
- `rust`
- `script`
- `swift`
- `system`
```

[`--log-file`](#prek-list--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-list--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--output-format`](#prek-list--output-format) *output-format* : The output format

```
[default: text]

Possible values:

- `text`
- `json`
```

[`--quiet`](#prek-list--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-list--refresh) : Refresh all cached data

[`--skip`](#prek-list--skip) *hook|project* : Skip the specified hooks or projects.

```
Supports flexible selector syntax:

- `hook-id`: Skip all hooks with the specified ID across all projects
- `project-path/`: Skip all hooks from the specified project
- `project-path:hook-id`: Skip only the specified hook from the specified project

Can be specified multiple times. Also accepts `PREK_SKIP` or `SKIP` environment variables (comma-delimited).
```

[`--verbose`](#prek-list--verbose), `-v` : Use verbose output

[`--version`](#prek-list--version), `-V` : Display the prek version

## prek uninstall

Uninstall prek Git shims

### Usage

```text
prek uninstall [OPTIONS]
```

### Options

[`--all`](#prek-uninstall--all) : Uninstall all prek-managed Git shims.

```
Scans the hooks directory and removes every hook managed by prek, regardless of hook type.
```

[`--cd`](#prek-uninstall--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-uninstall--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-uninstall--config), `-c` *config* : Path to alternate config file

[`--git-dir`](#prek-uninstall--git-dir) *git-dir* : Uninstall Git shims from the `hooks` subdirectory of the given git directory (`<GIT_DIR>/hooks/`).

```
When this flag is used, `prek uninstall` bypasses the safety check that normally refuses to modify shims while `core.hooksPath` is configured outside the repo. It only removes shims from `<GIT_DIR>/hooks`; Git may still use the configured `core.hooksPath` until that config changes.
```

[`--help`](#prek-uninstall--help), `-h` : Display the concise help for this command

[`--hook-type`](#prek-uninstall--hook-type), `-t` *hook-type* : Which Git shim(s) to uninstall.

```
Specifies which Git hook type(s) you want to uninstall shims for. Can be specified multiple times to uninstall shims for multiple hook types.

If not specified, uses `default_install_hook_types` from the config file, or defaults to `pre-commit` if that is also not set. Use `--all` to remove all prek-managed hooks.

Possible values:

- `commit-msg`
- `post-checkout`
- `post-commit`
- `post-merge`
- `post-rewrite`
- `pre-commit`
- `pre-merge-commit`
- `pre-push`
- `pre-rebase`
- `prepare-commit-msg`
```

[`--log-file`](#prek-uninstall--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-uninstall--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--quiet`](#prek-uninstall--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-uninstall--refresh) : Refresh all cached data

[`--verbose`](#prek-uninstall--verbose), `-v` : Use verbose output

[`--version`](#prek-uninstall--version), `-V` : Display the prek version

## prek validate-config

Validate configuration files (prek.toml or .pre-commit-config.yaml)

### Usage

```text
prek validate-config [OPTIONS] [CONFIG]...
```

### Arguments

[`CONFIG`](#prek-validate-config--configs) : The path to the configuration file

### Options

[`--cd`](#prek-validate-config--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-validate-config--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-validate-config--config), `-c` *config* : Path to alternate config file

[`--help`](#prek-validate-config--help), `-h` : Display the concise help for this command

[`--log-file`](#prek-validate-config--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-validate-config--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--quiet`](#prek-validate-config--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-validate-config--refresh) : Refresh all cached data

[`--verbose`](#prek-validate-config--verbose), `-v` : Use verbose output

[`--version`](#prek-validate-config--version), `-V` : Display the prek version

## prek validate-manifest

Validate `.pre-commit-hooks.yaml` files

### Usage

```text
prek validate-manifest [OPTIONS] [MANIFEST]...
```

### Arguments

[`MANIFEST`](#prek-validate-manifest--manifests) : The path to the manifest file

### Options

[`--cd`](#prek-validate-manifest--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-validate-manifest--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-validate-manifest--config), `-c` *config* : Path to alternate config file

[`--help`](#prek-validate-manifest--help), `-h` : Display the concise help for this command

[`--log-file`](#prek-validate-manifest--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-validate-manifest--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--quiet`](#prek-validate-manifest--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-validate-manifest--refresh) : Refresh all cached data

[`--verbose`](#prek-validate-manifest--verbose), `-v` : Use verbose output

[`--version`](#prek-validate-manifest--version), `-V` : Display the prek version

## prek sample-config

Produce a sample configuration file (prek.toml or .pre-commit-config.yaml)

### Usage

```text
prek sample-config [OPTIONS]
```

### Options

[`--cd`](#prek-sample-config--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-sample-config--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-sample-config--config), `-c` *config* : Path to alternate config file

[`--file`](#prek-sample-config--file), `-f` *file* : Write the sample config to a file.

```
Defaults to `.pre-commit-config.yaml` unless `--format toml` is set, which uses `prek.toml`. If a path is provided without `--format`, the format is inferred from the file extension (`.toml` uses TOML).
```

[`--format`](#prek-sample-config--format) *format* : Select the sample configuration format

```
Possible values:

- `yaml`
- `toml`
```

[`--help`](#prek-sample-config--help), `-h` : Display the concise help for this command

[`--log-file`](#prek-sample-config--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-sample-config--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--quiet`](#prek-sample-config--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-sample-config--refresh) : Refresh all cached data

[`--verbose`](#prek-sample-config--verbose), `-v` : Use verbose output

[`--version`](#prek-sample-config--version), `-V` : Display the prek version

## prek auto-update

Auto-update the `rev` field of repositories in the config file to the latest version

### Usage

```text
prek auto-update [OPTIONS]
```

### Options

[`--bleeding-edge`](#prek-auto-update--bleeding-edge) : Update to the bleeding edge of the default branch instead of the latest tagged version

[`--cd`](#prek-auto-update--cd), `-C` *dir* : Change to directory before running

[`--check`](#prek-auto-update--check) : Alias of `--dry-run` that exits with status 1 if updates would be made

[`--color`](#prek-auto-update--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-auto-update--config), `-c` *config* : Path to alternate config file

[`--cooldown-days`](#prek-auto-update--cooldown-days) *days* : Minimum release age (in days) required for a version to be eligible.

```
The age is computed from the tag creation timestamp for annotated tags, or from the tagged commit timestamp for lightweight tags. A value of `0` disables this check.

[default: 0]
```

[`--dry-run`](#prek-auto-update--dry-run) : Do not write changes to the config file, only display what would be changed

[`--freeze`](#prek-auto-update--freeze) : Store "frozen" hashes in `rev` instead of tag names

[`--help`](#prek-auto-update--help), `-h` : Display the concise help for this command

[`--jobs`](#prek-auto-update--jobs), `-j` *jobs* : Number of threads to use

```
[default: 0]
```

[`--log-file`](#prek-auto-update--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-auto-update--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--quiet`](#prek-auto-update--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-auto-update--refresh) : Refresh all cached data

[`--repo`](#prek-auto-update--repo) *repo* : Only update this repository. This option may be specified multiple times

[`--verbose`](#prek-auto-update--verbose), `-v` : Use verbose output

[`--version`](#prek-auto-update--version), `-V` : Display the prek version

## prek cache

Manage the prek cache

### Usage

```text
prek cache [OPTIONS] <COMMAND>
```

### Commands

[`prek cache dir`](#prek-cache-dir) : Show the location of the prek cache

[`prek cache gc`](#prek-cache-gc) : Remove unused cached repositories, hook environments, and other data

[`prek cache clean`](#prek-cache-clean) : Remove all prek cached data

[`prek cache size`](#prek-cache-size) : Show the size of the prek cache

### prek cache dir

Show the location of the prek cache

### Usage

```text
prek cache dir [OPTIONS]
```

### Options

[`--cd`](#prek-cache-dir--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-cache-dir--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-cache-dir--config), `-c` *config* : Path to alternate config file

[`--help`](#prek-cache-dir--help), `-h` : Display the concise help for this command

[`--log-file`](#prek-cache-dir--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-cache-dir--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--quiet`](#prek-cache-dir--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-cache-dir--refresh) : Refresh all cached data

[`--verbose`](#prek-cache-dir--verbose), `-v` : Use verbose output

[`--version`](#prek-cache-dir--version), `-V` : Display the prek version

### prek cache gc

Remove unused cached repositories, hook environments, and other data

### Usage

```text
prek cache gc [OPTIONS]
```

### Options

[`--cd`](#prek-cache-gc--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-cache-gc--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-cache-gc--config), `-c` *config* : Path to alternate config file

[`--dry-run`](#prek-cache-gc--dry-run) : Print what would be removed, but do not delete anything

[`--help`](#prek-cache-gc--help), `-h` : Display the concise help for this command

[`--log-file`](#prek-cache-gc--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-cache-gc--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--quiet`](#prek-cache-gc--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-cache-gc--refresh) : Refresh all cached data

[`--verbose`](#prek-cache-gc--verbose), `-v` : Use verbose output

[`--version`](#prek-cache-gc--version), `-V` : Display the prek version

### prek cache clean

Remove all prek cached data

### Usage

```text
prek cache clean [OPTIONS]
```

### Options

[`--cd`](#prek-cache-clean--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-cache-clean--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-cache-clean--config), `-c` *config* : Path to alternate config file

[`--help`](#prek-cache-clean--help), `-h` : Display the concise help for this command

[`--log-file`](#prek-cache-clean--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-cache-clean--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--quiet`](#prek-cache-clean--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-cache-clean--refresh) : Refresh all cached data

[`--verbose`](#prek-cache-clean--verbose), `-v` : Use verbose output

[`--version`](#prek-cache-clean--version), `-V` : Display the prek version

### prek cache size

Show the size of the prek cache

### Usage

```text
prek cache size [OPTIONS]
```

### Options

[`--cd`](#prek-cache-size--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-cache-size--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-cache-size--config), `-c` *config* : Path to alternate config file

[`--help`](#prek-cache-size--help), `-h` : Display the concise help for this command

[`--human`](#prek-cache-size--human), `--human-readable`, `-H` : Display the cache size in human-readable format (e.g., `1.2 GiB` instead of raw bytes)

[`--log-file`](#prek-cache-size--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-cache-size--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--quiet`](#prek-cache-size--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-cache-size--refresh) : Refresh all cached data

[`--verbose`](#prek-cache-size--verbose), `-v` : Use verbose output

[`--version`](#prek-cache-size--version), `-V` : Display the prek version

## prek try-repo

Try the pre-commit hooks in the current repo

### Usage

```text
prek try-repo [OPTIONS] <REPO> [HOOK|PROJECT]...
```

### Arguments

[`REPO`](#prek-try-repo--repo) : Repository to source hooks from

[`HOOK|PROJECT`](#prek-try-repo--includes) : Include the specified hooks or projects.

```
Supports flexible selector syntax:

- `hook-id`: Run all hooks with the specified ID across all projects
- `project-path/`: Run all hooks from the specified project
- `project-path:hook-id`: Run only the specified hook from the specified project

Can be specified multiple times to select multiple hooks/projects.
```

### Options

[`--all-files`](#prek-try-repo--all-files), `-a` : Run on all files in the repo

[`--cd`](#prek-try-repo--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-try-repo--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-try-repo--config), `-c` *config* : Path to alternate config file

[`--directory`](#prek-try-repo--directory), `-d` *dir* : Run hooks on all files in the specified directories.

```
You can specify multiple directories. It can be used in conjunction with `--files`.
```

[`--dry-run`](#prek-try-repo--dry-run) : Do not run the hooks, but print the hooks that would have been run

[`--fail-fast`](#prek-try-repo--fail-fast) : Stop running hooks after the first failure

[`--files`](#prek-try-repo--files) *files* : Specific filenames to run hooks on

[`--from-ref`](#prek-try-repo--from-ref), `--source`, `-s` *from-ref* : The original ref in a `<from_ref>...<to_ref>` diff expression. Files changed in this diff will be run through the hooks

[`--help`](#prek-try-repo--help), `-h` : Display the concise help for this command

[`--last-commit`](#prek-try-repo--last-commit) : Run hooks against the last commit. Equivalent to `--from-ref HEAD~1 --to-ref HEAD`

[`--log-file`](#prek-try-repo--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-try-repo--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--quiet`](#prek-try-repo--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-try-repo--refresh) : Refresh all cached data

[`--rev`](#prek-try-repo--rev), `--ref` *rev* : Manually select a rev to run against, otherwise the `HEAD` revision will be used

[`--show-diff-on-failure`](#prek-try-repo--show-diff-on-failure) : When hooks fail, run `git diff` directly afterward

[`--skip`](#prek-try-repo--skip) *hook|project* : Skip the specified hooks or projects.

```
Supports flexible selector syntax:

- `hook-id`: Skip all hooks with the specified ID across all projects
- `project-path/`: Skip all hooks from the specified project
- `project-path:hook-id`: Skip only the specified hook from the specified project

Can be specified multiple times. Also accepts `PREK_SKIP` or `SKIP` environment variables (comma-delimited).
```

[`--stage`](#prek-try-repo--stage), `--hook-stage` *stage* : The stage during which the hook is fired.

```
When specified, only hooks configured for that stage (for example `manual`, `pre-commit`, or `pre-push`) will run. Defaults to `pre-commit` if not specified. For hooks specified directly in the command line, fallback to `manual` stage if no hooks found for `pre-commit` stage.

Possible values:

- `manual`
- `commit-msg`
- `post-checkout`
- `post-commit`
- `post-merge`
- `post-rewrite`
- `pre-commit`
- `pre-merge-commit`
- `pre-push`
- `pre-rebase`
- `prepare-commit-msg`
```

[`--to-ref`](#prek-try-repo--to-ref), `--origin`, `-o` *to-ref* : The destination ref in a `from_ref...to_ref` diff expression. Defaults to `HEAD` if `from_ref` is specified

[`--verbose`](#prek-try-repo--verbose), `-v` : Use verbose output

[`--version`](#prek-try-repo--version), `-V` : Display the prek version

## prek util

Utility commands

### Usage

```text
prek util [OPTIONS] <COMMAND>
```

### Commands

[`prek util identify`](#prek-util-identify) : Show file identification tags

[`prek util list-builtins`](#prek-util-list-builtins) : List all built-in hooks bundled with prek

[`prek util init-template-dir`](#prek-util-init-template-dir) : Install Git shims in a directory intended for use with `git config init.templateDir`

[`prek util yaml-to-toml`](#prek-util-yaml-to-toml) : Convert a YAML configuration file to prek.toml

### prek util identify

Show file identification tags

### Usage

```text
prek util identify [OPTIONS] [PATH]...
```

### Arguments

[`PATH`](#prek-util-identify--paths) : The path(s) to the file(s) to identify

### Options

[`--cd`](#prek-util-identify--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-util-identify--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-util-identify--config), `-c` *config* : Path to alternate config file

[`--help`](#prek-util-identify--help), `-h` : Display the concise help for this command

[`--log-file`](#prek-util-identify--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-util-identify--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--output-format`](#prek-util-identify--output-format) *output-format* : The output format

```
[default: text]

Possible values:

- `text`
- `json`
```

[`--quiet`](#prek-util-identify--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-util-identify--refresh) : Refresh all cached data

[`--verbose`](#prek-util-identify--verbose), `-v` : Use verbose output

[`--version`](#prek-util-identify--version), `-V` : Display the prek version

### prek util list-builtins

List all built-in hooks bundled with prek

### Usage

```text
prek util list-builtins [OPTIONS]
```

### Options

[`--cd`](#prek-util-list-builtins--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-util-list-builtins--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-util-list-builtins--config), `-c` *config* : Path to alternate config file

[`--help`](#prek-util-list-builtins--help), `-h` : Display the concise help for this command

[`--log-file`](#prek-util-list-builtins--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-util-list-builtins--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--output-format`](#prek-util-list-builtins--output-format) *output-format* : The output format

```
[default: text]

Possible values:

- `text`
- `json`
```

[`--quiet`](#prek-util-list-builtins--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-util-list-builtins--refresh) : Refresh all cached data

[`--verbose`](#prek-util-list-builtins--verbose), `-v` : Use verbose output

[`--version`](#prek-util-list-builtins--version), `-V` : Display the prek version

### prek util init-template-dir

Install Git shims in a directory intended for use with `git config init.templateDir`

### Usage

```text
prek util init-template-dir [OPTIONS] <DIRECTORY>
```

### Arguments

[`DIRECTORY`](#prek-util-init-template-dir--directory) : The directory in which to write the Git shim

### Options

[`--cd`](#prek-util-init-template-dir--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-util-init-template-dir--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-util-init-template-dir--config), `-c` *config* : Path to alternate config file

[`--help`](#prek-util-init-template-dir--help), `-h` : Display the concise help for this command

[`--hook-type`](#prek-util-init-template-dir--hook-type), `-t` *hook-type* : Which Git shim(s) to install.

```
Specifies which Git hook type(s) you want to install shims for. Can be specified multiple times to install shims for multiple hook types.

If not specified, uses `default_install_hook_types` from the config file, or defaults to `pre-commit` if that is also not set.

Possible values:

- `commit-msg`
- `post-checkout`
- `post-commit`
- `post-merge`
- `post-rewrite`
- `pre-commit`
- `pre-merge-commit`
- `pre-push`
- `pre-rebase`
- `prepare-commit-msg`
```

[`--log-file`](#prek-util-init-template-dir--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-allow-missing-config`](#prek-util-init-template-dir--no-allow-missing-config) : Assume cloned repos should have a `pre-commit` config

[`--no-progress`](#prek-util-init-template-dir--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--quiet`](#prek-util-init-template-dir--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-util-init-template-dir--refresh) : Refresh all cached data

[`--verbose`](#prek-util-init-template-dir--verbose), `-v` : Use verbose output

[`--version`](#prek-util-init-template-dir--version), `-V` : Display the prek version

### prek util yaml-to-toml

Convert a YAML configuration file to prek.toml

### Usage

```text
prek util yaml-to-toml [OPTIONS] [CONFIG]
```

### Arguments

[`CONFIG`](#prek-util-yaml-to-toml--input) : The YAML configuration file to convert. If omitted, discovers `.pre-commit-config.yaml` or `.pre-commit-config.yml` in the current directory

### Options

[`--cd`](#prek-util-yaml-to-toml--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-util-yaml-to-toml--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-util-yaml-to-toml--config), `-c` *config* : Path to alternate config file

[`--force`](#prek-util-yaml-to-toml--force) : Overwrite the output file if it already exists

[`--help`](#prek-util-yaml-to-toml--help), `-h` : Display the concise help for this command

[`--log-file`](#prek-util-yaml-to-toml--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-util-yaml-to-toml--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--output`](#prek-util-yaml-to-toml--output), `-o` *output* : Path to write the generated prek.toml file. Defaults to `prek.toml` in the same directory as the input file

[`--quiet`](#prek-util-yaml-to-toml--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-util-yaml-to-toml--refresh) : Refresh all cached data

[`--verbose`](#prek-util-yaml-to-toml--verbose), `-v` : Use verbose output

[`--version`](#prek-util-yaml-to-toml--version), `-V` : Display the prek version

## prek self

`prek` self management

### Usage

```text
prek self [OPTIONS] <COMMAND>
```

### Commands

[`prek self update`](#prek-self-update) : Update prek

### prek self update

Update prek

### Usage

```text
prek self update [OPTIONS] [TARGET_VERSION]
```

### Arguments

[`TARGET_VERSION`](#prek-self-update--target_version) : Update to the specified version. If not provided, prek will update to the latest version

### Options

[`--cd`](#prek-self-update--cd), `-C` *dir* : Change to directory before running

[`--color`](#prek-self-update--color) *color* : Whether to use color in output

```
May also be set with the `PREK_COLOR` environment variable.

[default: auto]

Possible values:

- `auto`: Enables colored output only when the output is going to a terminal or TTY with support
- `always`: Enables colored output regardless of the detected environment
- `never`: Disables colored output
```

[`--config`](#prek-self-update--config), `-c` *config* : Path to alternate config file

[`--help`](#prek-self-update--help), `-h` : Display the concise help for this command

[`--log-file`](#prek-self-update--log-file) *log-file* : Write trace logs to the specified file. If not specified, trace logs will be written to `$PREK_HOME/prek.log`

[`--no-progress`](#prek-self-update--no-progress) : Hide all progress outputs.

```
For example, spinners or progress bars.
```

[`--quiet`](#prek-self-update--quiet), `-q` : Use quiet output.

```
Repeating this option, e.g., `-qq`, will enable a silent mode in which prek will write no output to stdout.

May also be set with the `PREK_QUIET` environment variable.
```

[`--refresh`](#prek-self-update--refresh) : Refresh all cached data

[`--token`](#prek-self-update--token) *token* : A GitHub token for authentication. A token is not required but can be used to reduce the chance of encountering rate limits

```
May also be set with the `GITHUB_TOKEN` environment variable.
```

[`--verbose`](#prek-self-update--verbose), `-v` : Use verbose output

[`--version`](#prek-self-update--version), `-V` : Display the prek version
