commitlint-rs icon indicating copy to clipboard operation
commitlint-rs copied to clipboard

Missing usage examples

Open FelixZY opened this issue 10 months ago • 1 comments

I'm missing actual usage examples. I've been able to figure some things out via the --help flag but would love to see a commit-msg hook example at minimum.

FelixZY avatar Feb 07 '25 23:02 FelixZY

Here's the commit-msg hook I set up:

#!/usr/bin/env sh

commitlint --edit "$1" || (printf "Your commit message was:\n\n%s\n" "$(cat "$1")" && exit 1)

A benefit of this hook is that it prints your commit message if linting fails. Not printing the commit message on lint failure has caused colleagues of mine to disable the linter in the past as they "lost" their message.

FelixZY avatar Feb 08 '25 00:02 FelixZY