Is there an existing issue or pull request for this?
Feature description
When using git-cliff with strict commit filtering (e.g., for a user-facing changelog), if the commit that a version tag points to gets filtered out, the entire version disappears from the changelog. This causes commits to appear under the wrong version.
Example scenario:
v2.14.0 tag points to commit fix(infra): update terraform config
- My
cliff-user.toml filters out (infra) scope commits (internal infrastructure changes)
- Result: Version
v2.14.0 completely disappears from the changelog, so commits that should be under v2.14.0 now appear under v2.14.1
Desired solution
I can think of two possible solutions:
Option 1: protect_tagged_commits
[git]
protect_tagged_commits = true
This would be similar to the existing protect_breaking_commits: it would prevent commits that have version tags pointing to them from being filtered out, ensuring version boundaries are preserved.
Option 2: preserve_version_boundaries
[git]
preserve_version_boundaries = true
This would ensure that git-cliff always includes all version headers in the output even if the commit with the version tag is filtered out.
Alternatives considered
I created a workaround script that:
- Generates context from a permissive config (all versions)
- Generates context from the strict config (filtered commits with groups)
- Merges them: takes version structure from
#1, commits from #2
- Uses
--from-context to generate the final changelog
This works but is complex and brittle. It also seems like this could be useful to other, not just me and so might be worth having in git-cliff itself.
Additional context
The configuration that causes this issue:
[git]
commit_parsers = [
# Skip internal scopes
{ message = ".*\\((infra)\\).*", skip = true },
# Categorize remaining
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Bug Fixes" },
]
Thanks for the great tool!
Is there an existing issue or pull request for this?
Feature description
When using git-cliff with strict commit filtering (e.g., for a user-facing changelog), if the commit that a version tag points to gets filtered out, the entire version disappears from the changelog. This causes commits to appear under the wrong version.
Example scenario:
v2.14.0tag points to commitfix(infra): update terraform configcliff-user.tomlfilters out(infra)scope commits (internal infrastructure changes)v2.14.0completely disappears from the changelog, so commits that should be underv2.14.0now appear underv2.14.1Desired solution
I can think of two possible solutions:
Option 1: protect_tagged_commits
This would be similar to the existing
protect_breaking_commits: it would prevent commits that have version tags pointing to them from being filtered out, ensuring version boundaries are preserved.Option 2: preserve_version_boundaries
This would ensure that git-cliff always includes all version headers in the output even if the commit with the version tag is filtered out.
Alternatives considered
I created a workaround script that:
#1, commits from#2--from-contextto generate the final changelogThis works but is complex and brittle. It also seems like this could be useful to other, not just me and so might be worth having in git-cliff itself.
Additional context
The configuration that causes this issue:
Thanks for the great tool!