Adds a pattern to the ignore list.
Adds a pattern to the ignore list.
By default the modifications affect only the user ignore list. To see the path
of the user ignore list, see the output of git hooks ignore show --user
. To
use the repository's ignore list use --repository
with optional --hook-name
.
To see the namespace paths of all hooks in the active repository, see
<ns-path>
in the output of git hooks list
.
The glob patterns to add given by --patterns <pattern>...
will match the
namespaced path <namespacePath>
of a hook. The namespace paths to add given by
--paths <ns-path>...
will match the full namespace path <namespacePath>
of a
hook.
The namespaced path of a hook file consists of <namespacePath>
≔
ns:<namespace>/<relPath>
, where <relPath>
is the relative path of the hook
with respect to a base directory <hooksDir>
. Note that a namespace path
<namespacePath>
always contains forward slashes as path separators (on any
platform).
The following values are set for <namespace>
and <hooksDir>
in the following
three cases:
For local repository hooks in <repo>/.githooks
:
<hooksDir>
≔<repo>/.githooks
<namespace>
≔ The first white-space trimmed line in the file<hooksDir>/.namespace
orns:gh-self
.
For shared repository hooks in <sharedRepo>
with url <url>
:
<hooksDir>
≔<sharedRepo>
<namespace>
≔ The first white-space trimmed line in the file<hooksDir>/.namespace
or the first 10 digits of the SHA1 hash of<url>
.
For previous replace hooks in <repo>/.git/hooks/<hookName>.replaced.githook
:
<hooksDir>
≔<repo>/.git/hooks
<namespace>
≔ns:gh-replaced
The glob pattern syntax supports the globstar
(double star) syntax in addition
to the syntax in 'https://golang.org/pkg/path/filepath/#Match'. Also you can use
negation with a prefix '!', where the '!' character is escaped by '!'. Every
pattern which does not start with the namespace suffix ns:
is automatically
treated as a relative pattern to the location of
git hooks ignore add [flags]
--pattern stringArray Specified glob pattern matching hook namespace paths.
--path stringArray Specified path fully matching a hook namespace path.
--repository The action affects the repository's main ignore list.
--hook-name string The action affects the repository's ignore list
in the subfolder `<hook-name>`.
(only together with `--repository` flag.)
-h, --help help for add
- git hooks ignore - Ignores or activates hook in the current repository.