A pre-commit hook that automatically keeps your pre-commit hooks up to date.
On every commit, this hook runs pre-commit autoupdate and stages any changes
to .pre-commit-config.yaml so they're included in your commit.
- Automatically updates all pre-commit hooks to their latest versions
- Stages updated
.pre-commit-config.yamlfor inclusion in the current commit - Works silently when no updates are available
- Zero configuration required
- You run
git commit - This hook runs
pre-commit autoupdate - If any hooks were updated, the changes are automatically staged
- Your commit includes the updated hook versions
- On your next commit, the new hook versions will be used
Add this hook to your .pre-commit-config.yaml:
repos:
# ... your other hooks ...
- repo: https://github.com/mosher-labs/pre-commit-autoupdate
rev: v1.0.0 # Use the latest release
hooks:
- id: autoupdateThen install the hooks:
pre-commit install- pre-commit must be installed and available in PATH
- Git repository with a
.pre-commit-config.yamlfile
Place this hook last in your repos list. This ensures all other hooks run first with the current versions, then updates are staged for the commit.
Upon first clone, install the pre-commit hooks:
pre-commit installTo run pre-commit hooks locally without a git commit:
pre-commit run -a --all-files