From 63247262ad691b7a28e59f0cdf822f1f47245379 Mon Sep 17 00:00:00 2001 From: Robsdedude Date: Mon, 6 Oct 2025 14:23:05 +0200 Subject: [PATCH] CONTRIBUTING.md: explain pre-commit hooks with working trees --- CONTRIBUTING.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c76b4b3b..1f838983 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,6 +56,21 @@ Make sure to install the pre-commit hook to your local repository: ```shell cp hooks/pre-commit .git/hooks/ +# or ln -rs hooks/pre-commit "$hooks/" +``` + +When working with working trees +```shell +# Run in the main tree: +git config extensions.worktreeconfig true +``` +```shell +# Run in each working tree +hooks="`git rev-parse --git-dir`/hooks" +git config --worktree core.hookspath "$hooks" +mkdir -p "$hooks" +cp hooks/pre-commit .git/hooks/ +# or ln -rs hooks/pre-commit "$hooks/" ``` ## Got an idea for a new project?