@@ -220,9 +220,16 @@ to run at the stage defined through that option. For instance,
220220to run at the ` push ` stage.
221221
222222Hooks can however be confined to a stage by setting the [ ` stages ` ] ( #config-stages )
223- property in your ` .pre-commit-config.yaml ` . The [ ` stages ` ] ( #config-stages ) property
224- is an array and can contain any of ` commit ` , ` merge-commit ` , ` push ` , ` prepare-commit-msg ` ,
223+ property in your ` .pre-commit-config.yaml ` , and the corresponding [ ` stages ` ] ( #hook-stages )
224+ property in the hook's ` .pre-commit-hooks.yaml ` definition. The ` stages ` properties
225+ are arrays and can contain any of ` commit ` , ` merge-commit ` , ` push ` , ` prepare-commit-msg ` ,
225226` commit-msg ` , ` post-checkout ` , ` post-commit ` , ` post-merge ` , ` post-rewrite ` , and ` manual ` .
227+ It is useful to provide an appropriate set of stages out of the box in
228+ ` .pre-commit-hooks.yaml ` hook definitions to avoid unnecessary runs of hooks in
229+ stages where they do not and can not do anything useful. For example, a
230+ reasonable setting for code formatter and the like hooks would be
231+ ` stages: [commit, merge-commit, push, manual] ` , and one for hooks that operate
232+ on commit messages could be ` stages: [commit-msg, manual] ` .
226233
227234If you do not want to have hooks installed by default on the stage passed
228235during a ` pre-commit install --hook-type ... ` , please set the [ ` default_stages ` ] ( #top_level-default_stages )
0 commit comments