Skip to content

CLI Reference

prek

Better pre-commit, re-engineered in Rust

Usage

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

Commands

prek install

Install prek as a git hook under the .git/hooks/ directory

prek install-hooks

Create environments for all hooks used in the config file

prek run

Run hooks

prek list

List hooks configured in the current workspace

prek uninstall

Uninstall prek from git hooks

prek validate-config

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

prek validate-manifest

Validate .pre-commit-hooks.yaml files

prek sample-config

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

prek auto-update

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

prek cache

Manage the prek cache

prek try-repo

Try the pre-commit hooks in the current repo

prek util

Utility commands

prek self

prek self management

prek install

Install prek as a git hook under the .git/hooks/ directory

Usage

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

Arguments

HOOK|PROJECT

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

Allow a missing configuration file

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--help, -h

Display the concise help for this command

--hook-type, -t hook-type

Which hook type(s) to install.

Specifies which git hook stage(s) you want to install the hook script for. Can be specified multiple times to install hooks for multiple stages.

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
--install-hooks

Create environments for all hooks used in the config file

--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

Hide all progress outputs.

For example, spinners or progress bars.

--overwrite, -f

Overwrite existing 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

Refresh all cached data

--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, -v

Use verbose output

--version, -V

Display the prek version

prek install-hooks

Create environments for all hooks used in the config file.

This command does not install the git hook. To install the git hook along with the hook environments in one command, use prek install --install-hooks.

Usage

prek install-hooks [OPTIONS] [HOOK|PROJECT]...

Arguments

HOOK|PROJECT

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, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--help, -h

Display the concise help for this command

--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

Hide all progress outputs.

For example, spinners or progress bars.

--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

Refresh all cached data

--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, -v

Use verbose output

--version, -V

Display the prek version

prek run

Run hooks

Usage

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

Arguments

HOOK|PROJECT

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, -a

Run on all files in the repo

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--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

Do not run the hooks, but print the hooks that would have been run

--fail-fast

Stop running hooks after the first failure

--files files

Specific filenames to run hooks on

--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, -h

Display the concise help for this command

--last-commit

Run hooks against the last commit. Equivalent to --from-ref HEAD~1 --to-ref HEAD

--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

Hide all progress outputs.

For example, spinners or progress bars.

--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

Refresh all cached data

--show-diff-on-failure

When hooks fail, run git diff directly afterward

--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, --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-commit) 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, --origin, -o to-ref

The destination ref in a from_ref...to_ref diff expression. Defaults to HEAD if from_ref is specified

--verbose, -v

Use verbose output

--version, -V

Display the prek version

prek list

List hooks configured in the current workspace

Usage

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

Arguments

HOOK|PROJECT

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, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--help, -h

Display the concise help for this command

--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 language

Show only hooks that are implemented in the specified language

Possible values:

  • bun
  • conda
  • coursier
  • dart
  • docker
  • docker-image
  • dotnet
  • fail
  • golang
  • haskell
  • julia
  • lua
  • node
  • perl
  • pygrep
  • python
  • r
  • ruby
  • rust
  • script
  • swift
  • system
--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

Hide all progress outputs.

For example, spinners or progress bars.

--output-format output-format

The output format

[default: text]

Possible values:

  • text
  • json
--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

Refresh all cached data

--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, -v

Use verbose output

--version, -V

Display the prek version

prek uninstall

Uninstall prek from git hooks

Usage

prek uninstall [OPTIONS]

Options

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--help, -h

Display the concise help for this command

--hook-type, -t hook-type

Which hook type(s) to uninstall.

Specifies which git hook stage(s) you want to uninstall. Can be specified multiple times to uninstall hooks for multiple stages.

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 log-file

Write trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log

--no-progress

Hide all progress outputs.

For example, spinners or progress bars.

--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

Refresh all cached data

--verbose, -v

Use verbose output

--version, -V

Display the prek version

prek validate-config

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

Usage

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

Arguments

CONFIG

The path to the configuration file

Options

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--help, -h

Display the concise help for this command

--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

Hide all progress outputs.

For example, spinners or progress bars.

--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

Refresh all cached data

--verbose, -v

Use verbose output

--version, -V

Display the prek version

prek validate-manifest

Validate .pre-commit-hooks.yaml files

Usage

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

Arguments

MANIFEST

The path to the manifest file

Options

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--help, -h

Display the concise help for this command

--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

Hide all progress outputs.

For example, spinners or progress bars.

--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

Refresh all cached data

--verbose, -v

Use verbose output

--version, -V

Display the prek version

prek sample-config

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

Usage

prek sample-config [OPTIONS]

Options

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--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 format

Select the sample configuration format

Possible values:

  • yaml
  • toml
--help, -h

Display the concise help for this command

--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

Hide all progress outputs.

For example, spinners or progress bars.

--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

Refresh all cached data

--verbose, -v

Use verbose output

--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

prek auto-update [OPTIONS]

Options

--bleeding-edge

Update to the bleeding edge of the default branch instead of the latest tagged version

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--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

Do not write changes to the config file, only display what would be changed

--freeze

Store "frozen" hashes in rev instead of tag names

--help, -h

Display the concise help for this command

--jobs, -j jobs

Number of threads to use

[default: 0]

--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

Hide all progress outputs.

For example, spinners or progress bars.

--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

Refresh all cached data

--repo repo

Only update this repository. This option may be specified multiple times

--verbose, -v

Use verbose output

--version, -V

Display the prek version

prek cache

Manage the prek cache

Usage

prek cache [OPTIONS] <COMMAND>

Commands

prek cache dir

Show the location of the prek cache

prek cache gc

Remove unused cached repositories, hook environments, and other data

prek cache clean

Remove all prek cached data

prek cache size

Show the size of the prek cache

prek cache dir

Show the location of the prek cache

Usage

prek cache dir [OPTIONS]

Options

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--help, -h

Display the concise help for this command

--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

Hide all progress outputs.

For example, spinners or progress bars.

--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

Refresh all cached data

--verbose, -v

Use verbose output

--version, -V

Display the prek version

prek cache gc

Remove unused cached repositories, hook environments, and other data

Usage

prek cache gc [OPTIONS]

Options

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--dry-run

Print what would be removed, but do not delete anything

--help, -h

Display the concise help for this command

--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

Hide all progress outputs.

For example, spinners or progress bars.

--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

Refresh all cached data

--verbose, -v

Use verbose output

--version, -V

Display the prek version

prek cache clean

Remove all prek cached data

Usage

prek cache clean [OPTIONS]

Options

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--help, -h

Display the concise help for this command

--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

Hide all progress outputs.

For example, spinners or progress bars.

--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

Refresh all cached data

--verbose, -v

Use verbose output

--version, -V

Display the prek version

prek cache size

Show the size of the prek cache

Usage

prek cache size [OPTIONS]

Options

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--help, -h

Display the concise help for this command

--human, --human-readable, -H

Display the cache size in human-readable format (e.g., 1.2 GiB instead of raw bytes)

--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

Hide all progress outputs.

For example, spinners or progress bars.

--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

Refresh all cached data

--verbose, -v

Use verbose output

--version, -V

Display the prek version

prek try-repo

Try the pre-commit hooks in the current repo

Usage

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

Arguments

REPO

Repository to source hooks from

HOOK|PROJECT

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, -a

Run on all files in the repo

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--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

Do not run the hooks, but print the hooks that would have been run

--fail-fast

Stop running hooks after the first failure

--files files

Specific filenames to run hooks on

--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, -h

Display the concise help for this command

--last-commit

Run hooks against the last commit. Equivalent to --from-ref HEAD~1 --to-ref HEAD

--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

Hide all progress outputs.

For example, spinners or progress bars.

--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

Refresh all cached data

--rev, --ref rev

Manually select a rev to run against, otherwise the HEAD revision will be used

--show-diff-on-failure

When hooks fail, run git diff directly afterward

--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, --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-commit) 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, --origin, -o to-ref

The destination ref in a from_ref...to_ref diff expression. Defaults to HEAD if from_ref is specified

--verbose, -v

Use verbose output

--version, -V

Display the prek version

prek util

Utility commands

Usage

prek util [OPTIONS] <COMMAND>

Commands

prek util identify

Show file identification tags

prek util list-builtins

List all built-in hooks bundled with prek

prek util init-template-dir

Install hook script in a directory intended for use with git config init.templateDir

prek util yaml-to-toml

Convert a YAML configuration file to prek.toml

prek util identify

Show file identification tags

Usage

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

Arguments

PATH

The path(s) to the file(s) to identify

Options

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--help, -h

Display the concise help for this command

--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

Hide all progress outputs.

For example, spinners or progress bars.

--output-format output-format

The output format

[default: text]

Possible values:

  • text
  • json
--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

Refresh all cached data

--verbose, -v

Use verbose output

--version, -V

Display the prek version

prek util list-builtins

List all built-in hooks bundled with prek

Usage

prek util list-builtins [OPTIONS]

Options

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--help, -h

Display the concise help for this command

--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

Hide all progress outputs.

For example, spinners or progress bars.

--output-format output-format

The output format

[default: text]

Possible values:

  • text
  • json
--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

Refresh all cached data

--verbose, -v

Use verbose output

--version, -V

Display the prek version

prek util init-template-dir

Install hook script in a directory intended for use with git config init.templateDir

Usage

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

Arguments

DIRECTORY

The directory in which to write the hook script

Options

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--help, -h

Display the concise help for this command

--hook-type, -t hook-type

Which hook type(s) to install.

Specifies which git hook stage(s) you want to install the hook script for. Can be specified multiple times to install hooks for multiple stages.

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 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

Assume cloned repos should have a pre-commit config

--no-progress

Hide all progress outputs.

For example, spinners or progress bars.

--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

Refresh all cached data

--verbose, -v

Use verbose output

--version, -V

Display the prek version

prek util yaml-to-toml

Convert a YAML configuration file to prek.toml

Usage

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

Arguments

CONFIG

The YAML configuration file to convert. If omitted, discovers .pre-commit-config.yaml or .pre-commit-config.yml in the current directory

Options

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--force

Overwrite the output file if it already exists

--help, -h

Display the concise help for this command

--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

Hide all progress outputs.

For example, spinners or progress bars.

--output, -o output

Path to write the generated prek.toml file. Defaults to prek.toml in the same directory as the input file

--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

Refresh all cached data

--verbose, -v

Use verbose output

--version, -V

Display the prek version

prek self

prek self management

Usage

prek self [OPTIONS] <COMMAND>

Commands

prek self update

Update prek

prek self update

Update prek

Usage

prek self update [OPTIONS] [TARGET_VERSION]

Arguments

TARGET_VERSION

Update to the specified version. If not provided, prek will update to the latest version

Options

--cd, -C dir

Change to directory before running

--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, -c config

Path to alternate config file

--help, -h

Display the concise help for this command

--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

Hide all progress outputs.

For example, spinners or progress bars.

--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

Refresh all cached data

--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, -v

Use verbose output

--version, -V

Display the prek version