From 5c579cff22fe848296ecea318166a4609ef30eb9 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Thu, 30 May 2024 01:31:24 +0200 Subject: [PATCH] chore(kb/lefthook): show how to skip --- knowledge base/lefthook.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/knowledge base/lefthook.md b/knowledge base/lefthook.md index 582d1ba..23cae28 100644 --- a/knowledge base/lefthook.md +++ b/knowledge base/lefthook.md @@ -47,6 +47,13 @@ lefthook uninstall -cv # Reset lefthook-managed git hooks and start from the beginning. lefthook uninstall && lefthook install + +# Disable lefthook for this commit. +LEFTHOOK=0 git commit -am "Lefthook skipped" +LEFTHOOK=false git commit -am "Lefthook skipped" + +# Avoid commands and scripts by name or tag for this commit. +LEFTHOOK_EXCLUDE=ruby,security,lint git commit -am "Skip some tag checks" ``` Uses the [glob library] for glob patterns. @@ -54,11 +61,13 @@ Uses the [glob library] for glob patterns. ## Configuration Configuration files can be written in JSON, TOML or YAML.
-Only one of them will be used, even if there are more than one in the repository. The chosen one will be the first one found during initialization, hence it is suggested to use a **single** configuration file in any of the above formats. +Only one of them will be used, even if there are more than one in the repository. The chosen one will be the first one +found during initialization, hence it is suggested to use a **single** configuration file in any of the above formats. The _main_ configuration file must exist and go by the name `lefthook.` or `.lefthook.`. -An _extra_ configuration file named `lefthook-local` is merged with the main file if found upon initialization. All supported formats can be applied to this `-local` file.
+An _extra_ configuration file named `lefthook-local` is merged with the main file if found upon initialization. All +supported formats can be applied to this `-local` file.
If the main configuration file starts with the leading dot, the `-local` file must also start with the leading dot. ```sh @@ -146,7 +155,8 @@ All the references in the [further readings] section, plus the following: - [Lefthook: knock your team's code back into shape]