Skip to content

No commits found to generate a pre-release #415

Description

@m1racoli

Description

cz bump --prerelease rc should handle missing "bumpable" commits the same way as cz bump.

Steps to reproduce

  1. create a non-bumpable commit (i.e. ci or build)
  2. run cz bump --prerelease rc --dry-run

Current behavior

The command terminates with an error:

$ cz bump --prerelease rc --dry-run
[NO_COMMITS_FOUND]
No commits found to generate a pre-release.
To avoid this error, manually specify the type of increment with `--increment`

Desired behavior

It should behave like running cz bump without --prerelease flag.

$ cz bump --dry-run                
bump: version 1.2.1 → 1.2.1 [skip ci]
tag to create: v1.2.1
increment detected: None

Environment

  • commitizen version: 2.18.0
  • python version: 3.9.4
  • operating system: Darwin

Activity

  1. Lee-W commented on Sep 6, 2021

    @Lee-W
    Member

    Thanks for reporting! This seems to be designed this way. See if this comment helps. #307 (comment)

  2. m1racoli commented on Sep 6, 2021

    @m1racoli
    Author

    Ok, I see the issue at hand.

    Our intention is to generate pre-releases automatically from the master branch in CI. If there are no corresponding changes it should just not do anything. Since we rely on commitizen to determine the kind of bump, it would be problematic to explicitly configure the increment.

    hmmmm

  3. Lee-W commented on Sep 7, 2021

    @Lee-W
    Member

    @woile I kinda don't get the idea of the original design. Would there be any issue if we check the pre-release commits as usual?

    #307 (comment)

  4. woile commented on Sep 7, 2021

    @woile
    Member

    Luckily I added the issue to the comments, seems to be related to this issue:
    #281

  5. Lee-W commented on Sep 11, 2021

    @Lee-W
    Member

    Yep, got your idea. @m1racoli Do you think this one better explains the design? Or is there a better solution for this one

  6. m1racoli commented on Sep 16, 2021

    @m1racoli
    Author

    Hmm ... I am not sure yet.

    If any release (alpha, beta, rc, prod) would bump the version if and only if there is a version increasing commit then we would not have a problem, no?

    I kinda expect the following behaviour when there is no version increasing commit:

    alpha -> alpha: do nothing
    alpha -> beta: only create beta tag
    alpha -> rc: only create rc tag
    alpha -> release: only create relase tag
    
    beta -> alpha: do nothing
    beta -> beta: do nothing
    beta -> rc: only create rc tag
    beta -> release: only create release tag
    
    rc -> alpha: do nothing
    rc -> beta: do nothing
    rc -> rc: do nothing
    rc -> release: only create release tag
    
    release -> alpha: do nothing
    release -> beta: do nothing
    release -> rc: do nothing
    release -> release: do nothing
    

    Basically we need to consider the different types of releases in a hierarchical order and only create a tag when we increase the level of release. And we'll never increase the version if there is not version increasing commit.

    I think it's quite common to first release something as RC and later release the same code as release. 🤔

    Does this make sense?

  7. Lee-W commented on Sep 19, 2021

    @Lee-W
    Member

    This makes sense to me. @woile what do you think?

  8. nbrugger-tgm commented on Nov 21, 2021

    @nbrugger-tgm

    Hi,
    i basically run into the same issue (not being able to release a RC as PROD).
    Is there a recommended workflow/workaround to go from RC to PROD without commits in between?

    Thanks

  9. bearomorphism commented on May 9, 2026

    @bearomorphism
    Collaborator

    Triage from #1964: Reviewed against master (4.15.1). The current behavior in commitizen/commands/bump.py (lines 217-225) still raises NoCommitsFoundError when --prerelease is given without bumpable commits and the current version isn't already a prerelease. This appears to be intentional (the workaround is --increment). Marking as a long-standing design choice — closing recommended unless someone wants to change the default.

  10. bearomorphism commented on May 9, 2026

    @bearomorphism
    Collaborator

    Verification update (re #1964)

    Reproduced against current master (4.15.1):

    Starting from v1.2.1 with only a ci: tweak commit:

    • cz bump --dry-run → exits 21 with [NO_COMMITS_TO_BUMP] The commits found are not eligible to be bumped
    • cz bump --prerelease rc --dry-run → exits 3 with [NO_COMMITS_FOUND] No commits found to generate a pre-release. To avoid this error, manually specify the type of increment with --increment``

    Verdict: STILL VALID — the asymmetric behavior reported in 2021 still exists today.

    The two exit codes / messages aren't quite parity:

    • Without --prerelease, you get NO_COMMITS_TO_BUMP (21).
    • With --prerelease, you get NO_COMMITS_FOUND (3) — a different error.

    This is documented behavior in commitizen/commands/bump.py:217-225, and arguably intentional (prerelease forces a decision; you can use --increment to override). But two valid changes worth considering:

    1. Make both paths exit with the same code (21) since semantically both mean "nothing to bump".
    2. When --prerelease is given but the current version isn't already a prerelease and there are no eligible commits, fall through to the same NoneIncrementExit branch rather than the special NoCommitsFoundError.

    Closely related to #688.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions