orhun / git-cliff

A highly customizable Changelog Generator that follows Conventional Commit specifications ⛰️

Home Page:https://git-cliff.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New "Unreleased" version is added again with --prepend

bofh69 opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

Every time I run:
git-cliff --prepend CHANGELOG.md HEAD^..

a new [Unreleased] section is added

Steps To Reproduce

How to reproduce:

cargo install git-cliff --version 2.1.2
git commit --allow-empty -m "fix: test git-cliff"
git-cliff -i keepachangelog
git-cliff HEAD^.. > CHANGELOG.md
git-cliff --prepend CHANGELOG.md HEAD^..
git-cliff --prepend CHANGELOG.md HEAD^..

Expected behavior

A single [Unreleased] section.

Screenshots / Logs

No response

Software information

  • Operating system: Ubuntu 22.04
  • Rust version: 1.76
  • Project version: 2.1.2

Additional context

We are in the middle of the development phase for our next release and I want us to start using git-cliff for generating the CHANGELOG.md file, but we don't want to lose the current content.

We have not used Conventional Commit messages before so we can't just start from the latest release.

As a workaround I guess I can add a commit with all the current entries, then remove the Unreleased section and use split_commits=true until after the next release, or add them with the GIT_CLIFF_WITH_COMMIT variable.

Thanks for opening your first issue at git-cliff! Be sure to follow the issue template! ⛰️

Same issue as #443 - let's have a single place of discussion!