From: Emily Shaffer Date: Thu, 27 May 2021 00:08:56 GMT Subject: [PATCH v9 37/37] docs: link githooks and git-hook manpages Message-ID: <20210527000856.695702-38-emilyshaffer@google.com> In-Reply-To: <20210527000856.695702-1-emilyshaffer@google.com> Since users may have an easier time finding 'man githooks' or 'git help githooks' through tab-completion or muscle memory, reference the 'git hook' commands. And in the 'git hook' manual, point users back to 'man githooks' for specifics about the hook events themselves. Signed-off-by: Emily Shaffer --- Documentation/git-hook.txt | 12 ++++++++++++ Documentation/githooks.txt | 7 ++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Documentation/git-hook.txt b/Documentation/git-hook.txt index 81b8e94994..24e00a6f4a 100644 --- a/Documentation/git-hook.txt +++ b/Documentation/git-hook.txt @@ -17,6 +17,13 @@ DESCRIPTION You can list and run configured hooks with this command. Later, you will be able to add and modify hooks with this command. +In general, when instructions suggest adding a script to +`.git/hooks/`, you can specify it in the config instead by running +`git config --add hook..command ` - this way you can +share the script between multiple repos. That is, `cp ~/my-script.sh +~/project/.git/hooks/pre-commit` would become `git config --add +hook.pre-commit.command ~/my-script.sh`. + This command parses the default configuration files for sections `hook` and `hookcmd`. `hook` is used to describe the commands which will be run during a particular hook event; commands are run in the order Git encounters them during @@ -141,6 +148,11 @@ number of CPUs on the current system. Some hooks may be ineligible for parallelization: for example, 'commit-msg' intends hooks modify the commit message body and cannot be parallelized. +HOOKS +----- +For a list of hooks which can be configured and how they work, see +linkgit:githooks[5]. + CONFIGURATION ------------- include::config/hook.txt[] diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt index 42e66d4e2d..d780cb3b18 100644 --- a/Documentation/githooks.txt +++ b/Documentation/githooks.txt @@ -7,15 +7,16 @@ githooks - Hooks used by Git SYNOPSIS -------- +'git hook' $GIT_DIR/hooks/* (or \`git config core.hooksPath`/*) DESCRIPTION ----------- -Hooks are programs you can place in a hooks directory to trigger -actions at certain points in git's execution. Hooks that don't have -the executable bit set are ignored. +Hooks are programs you can specify in your config (see linkgit:git-hook[1]) or +place in a hooks directory to trigger actions at certain points in git's +execution. Hooks that don't have the executable bit set are ignored. By default the hooks directory is `$GIT_DIR/hooks`, but that can be changed via the `core.hooksPath` configuration variable (see -- 2.31.1.818.g46aad6cb9e-goog