Skip to content

git-commit-message-summary-length

GitHub release (latest by date) GitHub commits since latest release

git-commit-message-summary-length splash card

git-commit-message-summary-length: Check the length of a commit message's first line.

Usage

shell
git commit-message-summary-length [--error-after=<length>] [--log-level=<log level>] [--warn-after=<length>] [<revision>]

Succeeds if the commit message summary's length is less than or equal to the "error after" length (default 72).

Fails if the commit message summary's length is greater than the "error after" length (default 72).

revision (default HEAD) is any revision parameter accepted by git log -1.

If the log level is 0, the command has no output.

If the log level is 1, the integer length of the commit message is logged.

If the log level is 2, the length of the commit message is logged in a sentence. It's colored yellow if the commit message summary's length is more than the "warn after" (default 50) length and shorter than or equal to the "error after" (default 72) length; it's colored red if the message is longer than the "error after" (default 72) length.

If the log level is 3 (default)

  • as with log level 2, the length of the commit message is logged in a sentence. It's colored yellow if the commit message summary's length is more than the "warn after" (default 50) length and shorter than or equal to the "error after" (default 72) length; it's colored red if the message is longer than the "error after" (default 72) length

  • and the commit message is logged, with characters after "warn after" and up to "error after" highlighted in yellow, and characters after "warn after" highlighted in red.