From 31e2ed74e71fe3ad0bffd850a5e674c5e98719e2 Mon Sep 17 00:00:00 2001 From: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com> Date: Mon, 23 Nov 2026 13:24:35 +0000 Subject: [PATCH] docs: pin v2.24.1 and document git's fixup subjects Pin the pre-commit snippets to v2.24.1, add its changelog entry, and say on CC002 to CC005, CC009 and the subject length options that the fixup!, squash! and amend! subjects git writes are not judged. --- docs/changelog.md | 6 ++++++ docs/compare/tools.md | 2 +- docs/configuration.md | 6 +++--- docs/example.md | 2 +- docs/guides/pre-commit.md | 6 +++--- docs/rules.md | 14 +++++++++++++- 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index d98836f..a5e57c6 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -46,6 +46,12 @@ page that documents it. | [2.5.0](#v250) | Organization-wide config with `inherit_from` | [Across an organization](guides/organization.md) | | [2.0.0](#v200) | Configuration moved from YAML to TOML — breaking | [Migrating from v1](migration.md) | +## v2.24.1 (2026-11-23) { #v2241 } + +### Fixed + +* CC002 to CC005 skip the `fixup!`, `squash!` and `amend!` subjects `git commit --fixup` and `--squash` write, so a fixup of a subject that fit the limit passes; CC009 still decides whether they are allowed. ([CC004](rules.md#cc004), [#734](https://github.com/commit-check/commit-check/pull/734)) + ## v2.24.0 (2026-11-22) { #v2240 } ### Added diff --git a/docs/compare/tools.md b/docs/compare/tools.md index bb44738..cb00b12 100644 --- a/docs/compare/tools.md +++ b/docs/compare/tools.md @@ -65,7 +65,7 @@ Replace the hook: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.24.0 + rev: v2.24.1 hooks: - id: check-message ``` diff --git a/docs/configuration.md b/docs/configuration.md index 99ae2d3..9f7a6aa 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -276,7 +276,7 @@ Used from a hook definition, with no config file anywhere in the repository: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.24.0 + rev: v2.24.1 hooks: - id: check-message args: @@ -403,8 +403,8 @@ These two sit above every section, at the top of the file. | `message_pattern` | str | "" (no custom pattern) | Custom regex pattern for commit message validation. When set, this pattern replaces the auto-generated Conventional Commits regex entirely, making it possible to enforce custom formats such as JIRA smart commits (e.g., `"^PROJ-\\d+: .+"`). When `message_pattern` is set (non-empty) it takes precedence over `conventional_commits`. | | `subject_capitalized` | bool | false | Subject must start with a capital letter. | | `subject_imperative` | bool | false | Subject must be in imperative mood. Judged on the first word's form, so a verb no list contains is still accepted — see [CC003](rules.md#cc003). | -| `subject_max_length` | int | 80 | Maximum length of the subject line, not counting the ` (#123)` a GitHub squash merge adds. The `Revert "..."` and `Reapply "..."` subjects `git revert` writes are not measured. Commits by `dependabot[bot]` and `renovate[bot]` skip it. `0` turns the check off. | -| `subject_min_length` | int | 5 | Minimum length of the subject line, not counting the ` (#123)` a GitHub squash merge adds. The `Revert "..."` and `Reapply "..."` subjects `git revert` writes are not measured. Commits by `dependabot[bot]` and `renovate[bot]` skip it. `0` turns the check off. | +| `subject_max_length` | int | 80 | Maximum length of the subject line, not counting the ` (#123)` a GitHub squash merge adds. The `Revert "..."` and `Reapply "..."` subjects `git revert` writes, and the `fixup!`, `squash!` and `amend!` ones `git commit --fixup` writes, are not measured. Commits by `dependabot[bot]` and `renovate[bot]` skip it. `0` turns the check off. | +| `subject_min_length` | int | 5 | Minimum length of the subject line, not counting the ` (#123)` a GitHub squash merge adds. The `Revert "..."` and `Reapply "..."` subjects `git revert` writes, and the `fixup!`, `squash!` and `amend!` ones `git commit --fixup` writes, are not measured. Commits by `dependabot[bot]` and `renovate[bot]` skip it. `0` turns the check off. | | `allow_commit_types` | list[str] | ["feat", "fix", "docs", "style", "refactor", "test", "chore", "perf", "build", "ci", "revert"] | Allowed commit types when conventional_commits is true. | | `allow_merge_commits` | bool | true | Allow merge commits. | | `allow_revert_commits` | bool | true | Allow the `Revert "..."` and `Reapply "..."` commits `git revert` writes. | diff --git a/docs/example.md b/docs/example.md index 7a3b2df..0dae860 100644 --- a/docs/example.md +++ b/docs/example.md @@ -186,7 +186,7 @@ pushed: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.24.0 + rev: v2.24.1 hooks: - id: check-no-force-push stages: [pre-push] diff --git a/docs/guides/pre-commit.md b/docs/guides/pre-commit.md index f47d075..a13b16f 100644 --- a/docs/guides/pre-commit.md +++ b/docs/guides/pre-commit.md @@ -8,7 +8,7 @@ Add Commit Check to `.pre-commit-config.yaml`: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.24.0 + rev: v2.24.1 hooks: - id: check-message - id: check-branch @@ -68,7 +68,7 @@ Options can be passed as hook arguments, which keeps everything in one file: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.24.0 + rev: v2.24.1 hooks: - id: check-message args: @@ -90,7 +90,7 @@ colon, and lets the commit through: ```yaml title=".pre-commit-config.yaml" repos: - repo: https://github.com/commit-check/commit-check - rev: v2.24.0 + rev: v2.24.1 hooks: - id: check-message args: [--fix] diff --git a/docs/rules.md b/docs/rules.md index bf48191..4535cf7 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -244,6 +244,10 @@ fix: Handle empty input * `commit.subject_capitalized` — set to `true` to enable this rule. +Merge subjects and the `fixup!`, `squash!` and `amend!` subjects git writes are +not judged: git writes them in lower case, and `--autosquash` would not find a +`Fixup!` commit. + ### subject-imperative (CC003) { #cc003 } **What it does** @@ -292,6 +296,9 @@ two apart. * `commit.subject_imperative` — set to `true` to enable this rule. +Merge subjects and the `fixup!`, `squash!` and `amend!` subjects git writes are +not judged. + ### subject-max-length (CC004) { #cc004 } **What it does** @@ -337,6 +344,10 @@ same root cause. author cannot shorten. Their other checks still run. * The `Revert "..."` and `Reapply "..."` subjects `git revert` writes, which add nine characters to a subject that already fit. CC005 skips them too. +* The `fixup!`, `squash!` and `amend!` subjects `git commit --fixup` and + `--squash` write, which add seven or eight characters to a subject that + already fit. CC005 skips them too, and [CC009](#cc009) decides whether they + are allowed. ### subject-min-length (CC005) { #cc005 } @@ -367,7 +378,8 @@ fix: reject config files with a null inherit_from * `commit.subject_min_length` — the minimum, in characters. Defaults to `5`. `0` turns the rule off. -The squash-merge ` (#123)` and the two dependency bots are treated as for +The squash-merge ` (#123)`, the two dependency bots and the subjects +`git revert`, `git commit --fixup` and `--squash` write are treated as for [CC004](#cc004). ### allow-merge-commits (CC006) { #cc006 }