git-hooks
Installs packaged Fast Forward Git hooks.
Description
The git-hooks
command installs the hook templates maintained in
resources/git-hooks
into the repository. It:
- Copies hook files from a source directory to the target hooks directory
- Sets executable permissions on copied hooks
Usage
composer git-hooks
composer git-hooks [options]
composer dev-tools git-hooks -- [options]
vendor/bin/dev-tools git-hooks [options]
Options
--source, -s(optional)- Path to the packaged Git hooks directory. Default:
resources/git-hooks. --target, -t(optional)- Path to the target Git hooks directory. Default:
.git/hooks. --no-overwrite- Do not overwrite existing hook files.
--dry-run- Preview managed Git hook drift without copying files.
--check- Exit with code
1when packaged Git hooks differ from the installed versions. --interactive- Prompt before replacing a drifted Git hook.
--json- Emit a structured machine-readable payload instead of the normal terminal output.
--pretty-json- Emit the same structured payload with indentation for terminal inspection.
Examples
Install hooks with defaults:
composer git-hooks
Install hooks without overwriting existing ones:
composer git-hooks --no-overwrite
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success. Hooks installed successfully. |
| 1 | Failure. Copy error. |