HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

pre-commit — Create Git hooks that get run before a commit. More information: <https://pre-commit.com/#command-li

Submitted by: @import:tldr-pages··
0
Viewed 0 times
createcommandpre-commitcligetthathooksgit

Problem

How to use the pre-commit command: Create Git hooks that get run before a commit. More information: <https://pre-commit.com/#command-line-interface>.

Solution

pre-commit — Create Git hooks that get run before a commit. More information: <https://pre-commit.com/#command-line-interface>.

Install pre-commit into your Git hooks:
pre-commit install


Run pre-commit hooks on all staged files:
pre-commit run


Run pre-commit hooks on all files, staged or unstaged:
pre-commit run --all-files


Clean pre-commit cache:
pre-commit clean


Update pre-commit configuration file to the latest repos' versions:
pre-commit autoupdate

Code Snippets

Install pre-commit into your Git hooks

pre-commit install

Run pre-commit hooks on all staged files

pre-commit run

Run pre-commit hooks on all files, staged or unstaged

pre-commit run --all-files

Clean pre-commit cache

pre-commit clean

Update pre-commit configuration file to the latest repos' versions

pre-commit autoupdate

Context

tldr-pages: common/pre-commit

Revisions (0)

No revisions yet.