Repository navigation
Tag not set correctly using devreleases with semver2 and custom tag_format #1615
Description
Activity
- addedos: Linuxissues related to linuxissues related to linux
on Sep 18, 2025 - changed the title
[-]Tag not set correctly using semver2 and custom tag_format[/-][+]Tag not set correctly using devreleases with semver2 and custom tag_format[/+]on Sep 18, 2025 May be related to #950
Reacted by Wei LeeTriage from #1964: Still valid.
commitizen/tags.py::normalize_tag(lines 195-223) only substitutesversion,major,minor,patch, andprerelease— there is nodevreleasesubstitution. So atag_formatreferencing${devrelease}(e.g.${major}.${minor}-${patch}${devrelease}) leaves that placeholder un-substituted in the rendered tag. Fix: adddevrelease=str(getattr(version, 'devrelease', '') or '')tosafe_substituteinnormalize_tag.Verification update (re #1964)
Reproduced against current master (4.15.1):
Config:
tag_format = "${major}.${minor}-${patch}${devrelease}",version_scheme = "semver2",version = "0.0.1".After
cz bump --devrelease 1 --yes:tag to create: 0.0-2${devrelease}git tag --list:0.0-2${devrelease}The literal
${devrelease}placeholder is not substituted, and a tag with${devrelease}in its name actually gets created.Verdict: STILL VALID.
Confirmed root cause in
commitizen/tags.py::normalize_tag(lines 195-223): thesafe_substitutecall only passesversion,major,minor,patch, andprerelease—devreleaseis missing.Patch:
return t.safe_substitute( version=version, major=major, minor=minor, patch=patch, prerelease=prerelease, devrelease=str(getattr(version, "devrelease", "") or ""), )
Note: while testing this, I also reproduced #1614 which has a related malformed-tag issue with
${prerelease}. Both should be fixed together — they share the samenormalize_tagtemplate-substitution path.- added a commit that references this issue
on May 15, 2026 @saisharan0103 Thanks for checking! I haven't checked whether my old AI generated PR above works and recently I don't have bandwidth on it. You can fork the PR in case it helps.
Description
When using a custom tag format like
${major}.${minor}-${patch}${devrelease}withsemver2the created tags miss thedevreleasepart. Further devreleases fail due to duplicate tags.Steps to reproduce
Current behavior
No
devreleasepart 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-2dev1Screenshots
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