git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] docs: document core.hooksPath=/dev/null

From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Date
Apr 16, 2025, 15:42 UTC
Message-ID
<pull.1899.v2.git.1744818135435.gitgitgadget@gmail.com>
In-Reply-To
<pull.1899.git.1743719888430.gitgitgadget@gmail.com>
From: Derrick Stolee <stolee@gmail.com>

If a user wishes to disable hooks, then they can do so using the established pattern of setting 'core.hooksPath' to /dev/null. This is already tested in t1350-config-hooks-path.sh, but has not previously been visible in the documentation.

Update the documentation to include this as an option.
Signed-off-by: Derrick Stolee <stolee@gmail.com>
---
    docs: document core.hooksPath=/dev/null
    
    Based on the discussion of the proposed --no-hooks option in v1, that
    code change is dropped in favor of this documentation of
    core.hooksPath=/dev/null.
    
    Thanks,
    
     * Stolee
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1899%2Fderrickstolee%2Fno-hooks-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1899/derrickstolee/no-hooks-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1899
Range-diff vs v1:
 1:  91e82850e7d < -:  ----------- git: add --no-hooks global option
 -:  ----------- > 1:  a9cd4bd5100 docs: document core.hooksPath=/dev/null
 Documentation/config/core.adoc | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/Documentation/config/core.adoc b/Documentation/config/core.adoc
index 8f6d8e77541..9fde1ab63a7 100644
--- a/Documentation/config/core.adoc
+++ b/Documentation/config/core.adoc
@@ -512,6 +512,11 @@ centrally configure your Git hooks instead of configuring them on a
 per-repository basis, or as a more flexible and centralized
 alternative to having an `init.templateDir` where you've changed
 default hooks.
++
+You can also disable all hooks entirely by setting `core.hooksPath`
+to `/dev/null`. This is usually only advisable for expert users and
+on a per-command basis using configuration parameters of the form
+`git -c core.hooksPath=/dev/null ...`.
 
 core.editor::
 	Commands such as `commit` and `tag` that let you edit

base-commit: 5b97a56fa0e7d580dc8865b73107407c9b3f0eff
-- 
gitgitgadget
Previous: D. Ben KnobleNext: Lucas Seiki Oshiro
Message 12 of 17 in “git: add --no-hooks global option”
  1. git: add --no-hooks global optionDerrick Stolee via GitGitGadget, Apr 3, 2025
  2. brian m. carlsonApr 3, 2025
  3. Derrick StoleeApr 4, 2025
  4. Phillip WoodApr 4, 2025
  5. Derrick StoleeApr 14, 2025
  6. Phillip WoodApr 16, 2025
  7. Junio C HamanoApr 16, 2025
  8. Derrick StoleeApr 16, 2025
  9. Lucas Seiki OshiroApr 14, 2025
  10. brian m. carlsonApr 14, 2025
  11. D. Ben KnobleApr 11, 2025
  12. docs: document core.hooksPath=/dev/nullDerrick Stolee via GitGitGadget, Apr 16, 2025
  13. Lucas Seiki OshiroApr 16, 2025
  14. Derrick StoleeApr 17, 2025
  15. brian m. carlsonApr 17, 2025
  16. Junio C HamanoApr 17, 2025
  17. Lucas Seiki OshiroApr 17, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.