Skip to content

Using --allow-no-commit on bump doesn't work (when updating CHANGELOG) #1866

Description

@alanbchristie

Description

  • python: 3.13.2
  • commitizen: 4.13.7
[tool.commitizen]
name = "cz_customize"
version_provider = "pep621"
version_scheme = "semver2"
annotated_tag = true
update_changelog_on_bump = true
changelog_merge_prerelease = true
prerelease_offset = 1
pre_bump_hooks = ["./add-issue-links-to-changelog.sh"]

It seems that I am unable to bump if there are no changes and I want to update the CHANGELOG. In spite of attempting to ignore the fact there are no changes by using --allow-no-commit, when I try and produce a new pre-release (e.g. with --prerelease rc) I get No commits found.

If I do not set update_changelog_on_bump = true then it appears to work.

But it is perfectly reasonable to: -

  1. Create a new release when there are no changes in the repository (i.e. going from beta to rc)
  2. Also alter the CHANGELOG (to indicate there has been a release but nothing has changed)

In summary ... --allow-no-commit should perform as advertised ... allow a release regardless of changes.

See discussion #1865

Steps to reproduce

Here's my config pyproject.toml commitizen configuration: -

[tool.commitizen]
name = "cz_customize"
version_provider = "pep621"
version_scheme = "semver2"
annotated_tag = true
update_changelog_on_bump = true
changelog_merge_prerelease = true
prerelease_offset = 1
pre_bump_hooks = ["./add-issue-links-to-changelog.sh"]

Bump a release (when there are changes, creating a beta release)

cz bump --allow-no-commit --prerelease beta`

Let's assume this creates 4.5.0-beta.5

Do it again (for a release candidate)

cz bump --allow-no-commit --prerelease rc`

In this case I get told...

bump: version 4.5.0-beta.5 → 4.5.0-rc.1
tag to create: 4.5.0-rc.1
increment detected: PATCH

No commits found

Current behavior

I'm told No commits found even though I have used --allow-no-commit

Desired behavior

Using --allow-no-commit should never result in the error No commits found

Screenshots

No response

Environment

Commitizen Version: 4.13.7
Python Version: 3.13.2 (v3.13.2:4f8bb3947cf, Feb 4 2025, 11:51:10) [Clang 15.0.0 (clang-1500.3.9.4)]
Operating System: Darwin

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions