# CLI Reference ## prek Better pre-commit, re-engineered in Rust
prek installInstall the prek git hook
prek install-hooksCreate hook environments for all hooks used in the config file
prek runRun hooks
prek listList available hooks
prek uninstallUninstall the prek git hook
prek validate-configValidate .pre-commit-config.yaml files
prek validate-manifestValidate .pre-commit-hooks.yaml files
prek sample-configProduce a sample .pre-commit-config.yaml file
prek auto-updateAuto-update pre-commit config to the latest repos' versions
prek gcClean unused cached repos
prek cleanClean out pre-commit files
prek init-template-dirInstall hook script in a directory intended for use with git config init.templateDir
prek try-repoTry the pre-commit hooks in the current repo
prek selfprek self management
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.
--allow-missing-configAllow a missing pre-commit configuration file
--cd, -C dirChange to directory before running
--color colorWhether 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 supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
--hook-type, -t hook-type--install-hooksCreate hook environments for all hooks used in the config file
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--overwrite, -fOverwrite existing hooks
--quiet, -qDo not print any output
--refreshRefresh all cached data
--skip hook|projectSkip 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, -vUse verbose output
--version, -VDisplay the prek version
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.
--cd, -C dirChange to directory before running
--color colorWhether 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 supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qDo not print any output
--refreshRefresh all cached data
--skip hook|projectSkip 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, -vUse verbose output
--version, -VDisplay the prek version
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.
--all-files, -aRun on all files in the repo
--cd, -C dirChange to directory before running
--color colorWhether 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 supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output--config, -c configPath to alternate config file
--directory, -d dirRun hooks on all files in the specified directories.
You can specify multiple directories. It can be used in conjunction with --files.
--dry-runDo not run the hooks, but print the hooks that would have been run
--files filesSpecific filenames to run hooks on
--from-ref, --source, -s from-refThe original ref in a <from_ref>...<to_ref> diff expression. Files changed in this diff will be run through the hooks
--help, -hDisplay the concise help for this command
--hook-stage hook-stageThe stage during which the hook is fired
[default: pre-commit]
Possible values:
manualcommit-msgpost-checkoutpost-commitpost-mergepost-rewritepre-commitpre-merge-commitpre-pushpre-rebaseprepare-commit-msg--last-commitRun hooks against the last commit. Equivalent to --from-ref HEAD~1 --to-ref HEAD
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qDo not print any output
--refreshRefresh all cached data
--show-diff-on-failureWhen hooks fail, run git diff directly afterward
--skip hook|projectSkip 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).
--to-ref, --origin, -o to-refThe destination ref in a from_ref...to_ref diff expression. Defaults to HEAD if from_ref is specified
--verbose, -vUse verbose output
--version, -VDisplay the prek version
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.
--cd, -C dirChange to directory before running
--color colorWhether 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 supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
--hook-stage hook-stageShow only hooks that has the specified stage
Possible values:
manualcommit-msgpost-checkoutpost-commitpost-mergepost-rewritepre-commitpre-merge-commitpre-pushpre-rebaseprepare-commit-msg--language languageShow only hooks that are implemented in the specified language
Possible values:
condacoursierdartdockerdocker-imagedotnetfailgolanghaskellluanodeperlpythonrrubyrustswiftpygrepscriptsystem--no-progressHide all progress outputs.
For example, spinners or progress bars.
--output-format output-formatThe output format
[default: text]
Possible values:
textjson--quiet, -qDo not print any output
--refreshRefresh all cached data
--skip hook|projectSkip 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, -vUse verbose output
--version, -VDisplay the prek version
--cd, -C dirChange to directory before running
--color colorWhether 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 supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
--hook-type, -t hook-type--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qDo not print any output
--refreshRefresh all cached data
--verbose, -vUse verbose output
--version, -VDisplay the prek version
The path to the configuration file
--cd, -C dirChange to directory before running
--color colorWhether 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 supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qDo not print any output
--refreshRefresh all cached data
--verbose, -vUse verbose output
--version, -VDisplay the prek version
The path to the manifest file
--cd, -C dirChange to directory before running
--color colorWhether 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 supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qDo not print any output
--refreshRefresh all cached data
--verbose, -vUse verbose output
--version, -VDisplay the prek version
--cd, -C dirChange to directory before running
--color colorWhether 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 supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output--config, -c configPath to alternate config file
--file, -f fileWrite the sample config to a file (.pre-commit-config.yaml by default)
--help, -hDisplay the concise help for this command
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qDo not print any output
--refreshRefresh all cached data
--verbose, -vUse verbose output
--version, -VDisplay the prek version
--bleeding-edgeUpdate to the bleeding edge of the default branch instead of the latest tagged version
--cd, -C dirChange to directory before running
--color colorWhether 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 supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output--config, -c configPath to alternate config file
--freezeStore "frozen" hashes in rev instead of tag names
--help, -hDisplay the concise help for this command
--jobs, -j jobsNumber of threads to use
[default: 3]
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qDo not print any output
--refreshRefresh all cached data
--repo repoOnly update this repository. This option may be specified multiple times
--verbose, -vUse verbose output
--version, -VDisplay the prek version
--cd, -C dirChange to directory before running
--color colorWhether 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 supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qDo not print any output
--refreshRefresh all cached data
--verbose, -vUse verbose output
--version, -VDisplay the prek version
--cd, -C dirChange to directory before running
--color colorWhether 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 supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qDo not print any output
--refreshRefresh all cached data
--verbose, -vUse verbose output
--version, -VDisplay the prek version
The directory in which to write the hook script
--cd, -C dirChange to directory before running
--color colorWhether 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 supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
--hook-type, -t hook-typeWhich hook type to install
Possible values:
commit-msgpost-checkoutpost-commitpost-mergepost-rewritepre-commitpre-merge-commitpre-pushpre-rebaseprepare-commit-msg--no-allow-missing-configAssume cloned repos should have a pre-commit config
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qDo not print any output
--refreshRefresh all cached data
--verbose, -vUse verbose output
--version, -VDisplay the prek version
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.
--all-files, -aRun on all files in the repo
--cd, -C dirChange to directory before running
--color colorWhether 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 supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output--config, -c configPath to alternate config file
--directory, -d dirRun hooks on all files in the specified directories.
You can specify multiple directories. It can be used in conjunction with --files.
--dry-runDo not run the hooks, but print the hooks that would have been run
--files filesSpecific filenames to run hooks on
--from-ref, --source, -s from-refThe original ref in a <from_ref>...<to_ref> diff expression. Files changed in this diff will be run through the hooks
--help, -hDisplay the concise help for this command
--hook-stage hook-stageThe stage during which the hook is fired
[default: pre-commit]
Possible values:
manualcommit-msgpost-checkoutpost-commitpost-mergepost-rewritepre-commitpre-merge-commitpre-pushpre-rebaseprepare-commit-msg--last-commitRun hooks against the last commit. Equivalent to --from-ref HEAD~1 --to-ref HEAD
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qDo not print any output
--refreshRefresh all cached data
--show-diff-on-failureWhen hooks fail, run git diff directly afterward
--skip hook|projectSkip 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).
--to-ref, --origin, -o to-refThe destination ref in a from_ref...to_ref diff expression. Defaults to HEAD if from_ref is specified
--verbose, -vUse verbose output
--version, -VDisplay the prek version
prek self updateUpdate prek
Update to the specified version. If not provided, prek will update to the latest version
--cd, -C dirChange to directory before running
--color colorWhether 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 supportalways: Enables colored output regardless of the detected environmentnever: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qDo not print any output
--refreshRefresh all cached data
--token tokenA 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, -vUse verbose output
--version, -VDisplay the prek version