This tutorial explains how to configure cocogitto to verify commits in your repository to conform to conventional commits.
Add cocogitto to your repository
Section titled “Add cocogitto to your repository”Cocogitto is available from Nixpkgs as cocogitto
package. You can add it to the dev shell of your flake.nix
:
devShells = { default = pkgs.mkShell { packages = [ pkgs.nodePackages.typescript pkgs.nodePackages.typescript-language-server pkgs.cocogitto ]; };};
Then generate cog.toml
:
cog init
Integrating Git hooks
Section titled “Integrating Git hooks”Cocogitto has a built-in functionality to install git hooks (see the documentation.)
This section describes how to integrate cocogitto into other git-hook frameworks.
git-hooks.nix
Section titled “git-hooks.nix”TODO: git-hooks.nix currently doesn't support cocogitto out of the box. It supports conform which is an alternative to cocogitto, so it would be possible to cocogitto.
Lefthook
Section titled “Lefthook”If you are using Lefthook, add the following snippet to lefthook.yml
to verify commits in commit-msg
hook:
commit-msg: runner: bash commands: cog: run: | cog verify --file {1}
More information
Section titled “More information”Follow the user guide for details.