Skip to content

Commit 9f89bbb

Browse files
fix(bump): Preserve existing changelog header when changelog_merge_prerelease is used with cz bump --changelog
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
1 parent f039a5e commit 9f89bbb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

commitizen/commands/changelog.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,11 @@ def __call__(self) -> None:
228228
self.file_name
229229
)
230230
if latest_full_release_info.index:
231-
changelog_meta.unreleased_start = 0
231+
# Use the existing unreleased_start if available (from get_metadata()).
232+
# Otherwise, use the position of the first version entry (prerelease)
233+
# to preserve the changelog header.
234+
if changelog_meta.unreleased_start is None:
235+
changelog_meta.unreleased_start = changelog_meta.latest_version_position
232236
changelog_meta.latest_version_position = latest_full_release_info.index
233237
changelog_meta.unreleased_end = latest_full_release_info.index - 1
234238

0 commit comments

Comments
 (0)