Skip to content

Mosher-Labs/pre-commit-autoupdate

Repository files navigation

pre-commit-autoupdate

GitHub branch status GitHub Issues GitHub last commit GitHub repo size GitHub License GitHub Sponsors

Introduction

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.

Key Features

  • Automatically updates all pre-commit hooks to their latest versions
  • Stages updated .pre-commit-config.yaml for inclusion in the current commit
  • Works silently when no updates are available
  • Zero configuration required

How It Works

  1. You run git commit
  2. This hook runs pre-commit autoupdate
  3. If any hooks were updated, the changes are automatically staged
  4. Your commit includes the updated hook versions
  5. On your next commit, the new hook versions will be used

Usage

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

Then install the hooks:

pre-commit install

Requirements

  • pre-commit must be installed and available in PATH
  • Git repository with a .pre-commit-config.yaml file

Recommended Placement

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.

Contributing

Upon first clone, install the pre-commit hooks:

pre-commit install

To run pre-commit hooks locally without a git commit:

pre-commit run -a --all-files

Sponsor this project

 

Packages

No packages published

Contributors 2

  •  
  •  

Languages