pre-commit autoupdate: Bump Hook Revisions
pre-commit autoupdate rewrites the rev of each repo in your config to its latest released tag.
Hook repos pin to a rev. autoupdate moves those pins forward so you stay on current tool versions, typically run on a schedule by a bot.
What it does
pre-commit autoupdate clones each repo in .pre-commit-config.yaml, finds the latest git tag, and updates the rev field to it. It only edits the config file; it does not run any hooks.
Common usage
pre-commit autoupdate
# pin to the exact commit sha of the tag for reproducibility
pre-commit autoupdate --freeze
# update only one repo
pre-commit autoupdate --repo https://github.com/psf/blackOptions
| Flag | What it does |
|---|---|
| --bleeding-edge | Update to the latest commit on the default branch, not the latest tag |
| --freeze | Record the tag as a frozen commit sha for reproducibility |
| --repo <url> | Update only the named repo (repeatable) |
| -j / --jobs <n> | Run the updates in parallel |
In CI
Run autoupdate on a schedule and open a pull request with the diff, or let pre-commit.ci do it via its autoupdate_schedule setting. Use --freeze when you want the rev pinned to an immutable sha so a re-tagged release cannot change behavior under you.
Common errors in CI
"[INFO] Initializing environment" then a clone failure means the runner cannot reach the hook repo (proxy or offline runner); autoupdate needs network access to every repo url. If a repo has no tags, autoupdate cannot find a rev and leaves it unchanged unless you pass --bleeding-edge. A rev that no longer exists after a force-push yields a checkout error on the next run.