This package provides a set of tools to ensure a level of quality and productivity adapted to the current state of the art in development.
Run the ./install.sh command.
By default it configures globally Git to use the Git Hooks feature.
By using the -t flag, it configures globally Git to use the Git Templates feature.
Please note that:
- both Git Hooks and Git Templates features are mutually exclusive.
- already existing
Gitconfiguration are saved in order to be restored during uninstallation.
- libgit2 — required by
cocogitto. The install script detects its presence and offers to install it automatically (pkgon Termux,apt-geton Debian/Ubuntu) or prints instructions for other systems.
Run ./install.sh -u.
All 28 git-documented hooks are registered globally via a dispatcher configured through core.hooksPath.
The commit-msg hook:
- ensures that the committed message follows the Conventional Commits specification.
- ensures that the committed message is enhanced by an icon corresponding to its type.
Please refer to the
[commit_type_icons]section of the config.toml file to see or change icons. - allows a bunch of additional types.
Please refer to the
[commit_types]section of the cog.toml file to see or change these additional types.
Additional types and icons were grandly inspired by the work of Danny FRITZ (@dannyfritz) and Danny (@its-danny).
To disable commit message validation for a specific repository (e.g. when working with a legacy commit style), set the repo-scoped git config:
git config hook.legacyCommitMessage trueAlternatively, set the environment variable LEGACY_COMMIT_MESSAGE=1 before running git commit.
Each hook dispatches in order: local before → global handler → local after.
Local hooks are placed in .git/hooks/ of the target repository. Two naming formats are accepted and can be combined:
| File | Runs |
|---|---|
<hook>.before or before.<hook> |
before the global handler |
<hook>.after or after.<hook> |
after the global handler |
<hook> (no suffix) |
after the global handler (default) |
Example — run a project linter before the global commit-msg validation:
# .git/hooks/commit-msg.before
#!/usr/bin/env bash
set -euo pipefail
./scripts/lint-commit-msg.sh "$1"chmod +x .git/hooks/commit-msg.beforeNo registration needed — the dispatcher picks up local hooks automatically.
See docs/local-hooks.md for the full reference and docs/git-hooks-lifecycle.md for the execution order of all 28 hooks.
For now the templates are the same as the ones provided by Git except for the hooks which are symlinks to this package hooks.
This is a convenient way to keep them in an up to date state.
The integration of this feature relies on the git configuration setting init.templateDir, set globally.
Please refer to thirdpartylibs.md.
This project is licensed under the terms of the MIT License.