@@ -21,9 +21,109 @@ This edition covers what happened during the months of April 2025 and May 2025.
2121### General
2222-->
2323
24- <!-- -
24+
2525### Reviews
26- -->
26+
27+ * [[ PATCH] git: add --no-hooks global option] ( https://lore.kernel.org/git/pull.1899.git.1743719888430.gitgitgadget@gmail.com/ )
28+
29+ Derrick Stolee, who prefers to be called just Stolee, sent a patch
30+ to the mailing list that added a new ` --no-hooks ` global option, and
31+ an equivalent ` GIT_HOOKS ` environment variable, to Git. The goal was
32+ to allow users to disable all Git hooks during command execution.
33+
34+ This could be useful for expert users who would want to bypass
35+ pre-commit hooks when they have poor performance or perform useless
36+ checks.
37+
38+ Switching between enabled and disabled hooks and other workarounds,
39+ like setting ` core.hooksPath ` to a "bogus path" did not look
40+ convenient and very safe.
41+
42+ brian m. carlson, who spell their name using only lowercase letters,
43+ replied to Stolee acknowledging the need for this functionality as
44+ some Jenkins users already set ` core.hooksPath ` to ` /dev/null ` for
45+ security reasons. They warned that disabling hooks could break
46+ [ Git LFS] ( https://git-lfs.com/ ) in a way that is "less noticeable
47+ and detectable" than the current ` /dev/null ` approach.
48+
49+ They agreed that certain hooks like pre-commit hooks should be
50+ optional, for example to make it easy to commit some
51+ work-in-progress that doesn't meet standards, but saw fewer reasons
52+ to bypass hooks that could be important for repository integrity.
53+
54+ Stolee agreed that some hooks are important for integrity, but said
55+ his intention was on the side of optional hooks.
56+
57+ Phillip Wood also replied to Stolee's initial email noting that
58+ there is already ` git commit --no-verify ` which bypasses the
59+ pre-commit and commit-msg hooks. He argued that hooks so slow that
60+ users want to bypass them are self-defeating and that the solution
61+ should be to fix the hook's performance rather than make it easier
62+ to skip. About setting ` core.hooksPath ` to ` /dev/null ` , he asked why
63+ it could be unsafe. In general he said he wasn't convinced that
64+ ` --no-hooks ` was a good idea, and later asked for "a clearer
65+ motivation" to better understand its usefulness.
66+
67+ Stolee agreed that setting ` core.hooksPath ` to ` /dev/null ` was safe,
68+ and said he had forgotten that could be used instead of a bogus
69+ path.
70+
71+ Junio Hamano, the Git maintainer, then replied to Phillip thanking
72+ him for pushing back on the idea, and saying that there should be a
73+ "compelling reason" to justify applying a change.
74+
75+ Also instead of implementing options to disable hooks or
76+ configuration in some user facing "porcelain" commands, Junio
77+ advocated for cleaning up and refactoring these commands into new
78+ stable "plumbing" commands designed to be easily used in scripts.
79+
80+ Lucas Seiki Oshiro in the meantime replied to Phillip. Lucas had
81+ noticed that using ` /dev/null ` to disable hooks wasn't mentioned in
82+ the documentation of ` core.hooksPath ` even though it was tested in a
83+ test script. He asked if Stolee's patch should therefore be turned
84+ into a documentation patch.
85+
86+ brian agreed with Lucas that documenting how to disable hooks was a
87+ good idea even if the ` --no-hooks ` option wasn't implemented.
88+
89+ D. Ben Knoble also replied to Stolee's initial patch. He supported
90+ the addition of the ` --no-hooks ` option, sharing his own
91+ frustrations with poorly performing or difficult-to-manage hooks. He
92+ described how a tool re-enables hooks after every ` npm install `
93+ leading him to overuse ` --no-verify ` , which he considered a worse
94+ situation. He believed there should be a safe and sane way to
95+ disable optional client-side hooks and felt that a ` --no-hooks `
96+ option would be useful, potentially encouraging better practices
97+ like moving certain checks to server-side hooks.
98+
99+ Stolee then replied to Junio thanking him for deciding about this
100+ and saying he would follow up with a version 2 of his patch that
101+ would only document that setting ` core.hooksPath ` to ` /dev/null ` was
102+ the supported mechanism to disable hooks.
103+
104+ In [ the version 2 of his patch] ( https://lore.kernel.org/git/pull.1899.v2.git.1744818135435.gitgitgadget@gmail.com/ )
105+ indeed Stolee only updated the documentation of the ` core.hooksPath `
106+ configuration option, adding the following small paragraph:
107+
108+ > You can also disable all hooks entirely by setting ` core.hooksPath `
109+ > to ` /dev/null ` . This is usually only advisable for expert users and
110+ > on a per-command basis using configuration parameters of the form
111+ > ` git -c core.hooksPath=/dev/null ... ` .
112+
113+ Lucas replied to that new patch. He suggested rewording the
114+ documentation to focus on non-expert users rather than
115+ experts. Stolee disagreed, explaining he intentionally targeted
116+ expert users as a "there be dragons here" warning about the risks of
117+ disabling hooks.
118+
119+ brian supported Stolee's approach, agreeing that this feature should
120+ be presented as expert-only due to the potential for data loss (like
121+ missing Git LFS uploads). He appreciated Stolee's gracious pivot
122+ from code changes to documentation.
123+
124+ Junio also thanked Stolee for gracefully changing direction and
125+ ensuring no loose ends were left after abandoning the original
126+ approach.
27127
28128<!-- -
29129### Support
0 commit comments