Skip to content

MAJOR,MINOR,PATCH config that takes in consideration the branch #1572

Open

Description

@andyinno

Description

First of all, thank you for this program. I really enjoy using it.

I looked for a way to perform what I need but I was not able to find the necessary information, therefore I suspect this is not something possible at the moment, ence, the feature request.

I am currently using commitizen on projects in which:

  • main branch accept only major and minor
  • release branches that accept only patch (no breaking changes are allwed during patch fixes)

At the moment this is handled manually, the user needs to check which version will be issued and manually specify the version or correctly manage the commit name in order to obtain the right next-value.

problem is I won't trust who is performing the tag to make the correct tag. I would like to have it automated and enforced at configuration level.

Thank you for reading.
Hope this could be something interesting

Possible Solution

I would like to be able to write in the config file something like:

min_value = [
"main": "minor",
"release/": "patch"
]
max_value = [
"main": "major",
"release/
": "patch"
]

This will allow to cherry pick a fix and perform the bump without editing the commit message, or without specify the wanted increment on the command line.

Additional context

No response

Related issues

No response

Activity

  1. bearomorphism commented on May 9, 2026

    @bearomorphism
    Collaborator

    This is an architectural feature ask: branch-aware bump rules. There are three open design questions a maintainer needs to call before any PR makes sense:

    1. Configuration shape. Is the rule per-branch ([tool.commitizen.branches.main], [tool.commitizen.branches."release/*"]) or a list of { pattern, max_increment, min_increment } rows? The latter scales better but is more verbose.
    2. Detection of "current branch". cz bump is sometimes invoked from CI in a detached-HEAD state (after a PR merge). Do branch rules apply by git rev-parse --abbrev-ref HEAD, by the GitHub Actions GITHUB_REF, by an explicit --branch flag, or by all three with priority?
    3. Interaction with --increment / --prerelease. If the user passes --increment MAJOR but the branch rule caps at MINOR, do we error or downgrade?

    Until these are decided, any PR is going to need a redesign. Surfacing via the round-2 triage in #1965 — flagging that this is a maintainer-design item rather than an implementation-ready one.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions