Skip to content

Tag not set correctly using devreleases with semver2 and custom tag_format #1615

@pydal

Description

@pydal

Description

When using a custom tag format like ${major}.${minor}-${patch}${devrelease} with semver2 the created tags miss the devrelease part. Further devreleases fail due to duplicate tags.

Steps to reproduce

  1. Initialize git project and place cz configuration:
git init .
cat << EOF | tee cz.toml
[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "\${major}.\${minor}-\${patch}\${devrelease}"
version_scheme = "semver2"
version = "0.0.1"
update_changelog_on_bump = true
EOF
  1. Create a first commit
echo "# test" | tee README.md
git add README.md cz.toml
git commit -m "fix: Add readme file"
  1. Bump a devrelease
cz bump --devrelease 1 --yes
  1. Observe incorrect "tag to create" in output tag (note ${devrelease})
bump: version 0.0.1 → 0.0.2-dev.1
tag to create: 0.0-2${devrelease}
increment detected: PATCH
  1. Observe inccorect git tag
git tag -l
  1. Trying to add more changes and bump the next devrelease will fail

Current behavior

No devrelease part is added according to the configuration. The tag equals ${major}.${minor}-${patch} which produces further errors using a next devrelease.

Desired behavior

The tag shall be set correctly according to custom tag_format and semver2 convention like 0.0-2dev1

Screenshots

n/a

Environment

Commitizen Version: 4.9.1
Python Version: 3.9.21 (main, Aug 19 2025, 00:00:00)
[GCC 11.5.0 20240719 (Red Hat 11.5.0-5)]
Operating System: Linux

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