|
| 1 | +git-hook(1) |
| 2 | +=========== |
| 3 | + |
| 4 | +NAME |
| 5 | +---- |
| 6 | +git-hook - Manage configured hooks |
| 7 | + |
| 8 | +SYNOPSIS |
| 9 | +-------- |
| 10 | +[verse] |
| 11 | +'git hook' list [--porcelain] <hook-name> |
| 12 | + |
| 13 | +DESCRIPTION |
| 14 | +----------- |
| 15 | +You can list, add, and modify hooks with this command. |
| 16 | + |
| 17 | +This command parses the default configuration files for sections "hook" and |
| 18 | +"hookcmd". "hook" is used to describe the commands which will be run during a |
| 19 | +particular hook event; commands are run in config order. "hookcmd" is used to |
| 20 | +describe attributes of a specific command. If additional attributes don't need |
| 21 | +to be specified, a command to run can be specified directly in the "hook" |
| 22 | +section; if a "hookcmd" by that name isn't found, Git will attempt to run the |
| 23 | +provided value directly. For example: |
| 24 | + |
| 25 | +Global config |
| 26 | +---- |
| 27 | + [hook "post-commit"] |
| 28 | + command = "linter" |
| 29 | + command = "~/typocheck.sh" |
| 30 | + |
| 31 | + [hookcmd "linter"] |
| 32 | + command = "/bin/linter --c" |
| 33 | +---- |
| 34 | + |
| 35 | +Local config |
| 36 | +---- |
| 37 | + [hook "prepare-commit-msg"] |
| 38 | + command = "linter" |
| 39 | + [hook "post-commit"] |
| 40 | + command = "python ~/run-test-suite.py" |
| 41 | +---- |
| 42 | + |
| 43 | +COMMANDS |
| 44 | +-------- |
| 45 | + |
| 46 | +list [--porcelain] <hook-name>:: |
| 47 | + |
| 48 | +List the hooks which have been configured for <hook-name>. Hooks appear |
| 49 | +in the order they should be run, and note the config scope where the relevant |
| 50 | +`hook.<hook-name>.command` was specified, not the `hookcmd` (if applicable). |
| 51 | ++ |
| 52 | +If `--porcelain` is specified, instead print the commands alone, separated by |
| 53 | +newlines, for easy parsing by a script. |
| 54 | + |
| 55 | +OPTIONS |
| 56 | +------- |
| 57 | +--porcelain:: |
| 58 | + With `list`, print the commands in the order they should be run, |
| 59 | + separated by newlines, for easy parsing by a script. |
| 60 | + |
| 61 | +GIT |
| 62 | +--- |
| 63 | +Part of the linkgit:git[1] suite |
0 commit comments