Skip to content
Back to log

How to maintain a changelog

Chainabit's Chao · · 6 min read

In short

Organize your changelog by version and change type, and see how to generate and customize release notes on GitHub.

Keep a Changelog defines a changelog as a file containing a curated, chronological list of significant changes in each version of a project. It makes it easier for users and contributors to see what changed between versions.

A changelog is for the people who use and develop the software. In the Keep a Changelog approach, each version has its own entry. Changes of the same type are grouped together, and versions and sections can be linked. The latest version appears at the top of the list.

Create the file and change headings

Keep a Changelog recommends naming the file CHANGELOG.md. Some projects use HISTORY, NEWS, or RELEASES for the same purpose. It also recommends stating whether the project uses Semantic Versioning.

Group changes by type under each version. Keep a Changelog defines six headings for these groups:

  • Added: New features.
  • Changed: Changes to existing functionality.
  • Deprecated: Features slated for removal.
  • Removed: Features that have been removed.
  • Fixed: Bug fixes.
  • Security: Changes related to security vulnerabilities.

Deprecated indicates that a feature will be removed in the future. Removed records that the feature has already been removed. Keep a Changelog calls for making it clear which changes may break compatibility during an upgrade.

The approach gives users a chance to upgrade to a version that lists deprecated features, stop using those features, and then move to the version that removes them. At a minimum, it calls for listing deprecations, removals, and breaking changes in the changelog.

Record significant changes consistently. According to Keep a Changelog, a change as small as removing a single space may only need to be recorded in some cases. Listing only some significant changes can leave readers with the impression that the list is complete.

Track unreleased changes separately

Keep a Changelog recommends keeping an Unreleased section at the top of the file to track upcoming changes. This section lets readers see what might be included in future versions.

When you publish a release, you can move the changes from Unreleased into a section for that version. In the Keep a Changelog example, version headings link to comparisons between Git tags.

Keep commit lists separate from changelog entries

Keep a Changelog advises against using commit log diffs directly as a changelog. These lists can contain merge commits, commits with unclear titles, and other changes.

A commit records a step in the evolution of the code. A changelog entry explains a change that matters to users. That change may span several commits. Keep a Changelog notes that some projects curate their commits and others leave their commit history as it is.

You can fill in gaps later. Keep a Changelog lists adding missing versions to a neglected changelog and documenting an overlooked breaking change in a version’s notes as reasons to update a changelog.

Mark yanked releases

According to Keep a Changelog, releases withdrawn because of a serious bug or security issue should still appear in the changelog. The approach uses [YANKED] in the version heading to flag these releases. The square brackets also make the marker easier to parse programmatically.

Yanked releases sometimes disappear from changelogs entirely. Keep a Changelog emphasizes making the marker visible so readers can spot the release’s status.

If you use Semantic Versioning

Keep a Changelog recommends stating whether you use Semantic Versioning. Semantic Versioning assigns a meaning to each part of a version number in the MAJOR.MINOR.PATCH format. Backward-incompatible API changes increment MAJOR, backward-compatible additions to functionality increment MINOR, and backward-compatible bug fixes increment PATCH.

Software that uses Semantic Versioning must declare a public API. The standard allows that API to be defined in the code itself. Marking public API functionality as Deprecated requires a MINOR version increment. A backward-incompatible change to the public API requires a MAJOR version increment.

Turn this insight into action.

Use the mobile app to continue with guided workflows.

Under Semantic Versioning, a MINOR increment can include PATCH-level changes. A MAJOR increment can include both MINOR- and PATCH-level changes. The standard requires resetting PATCH to zero when MINOR increases and resetting both MINOR and PATCH to zero when MAJOR increases.

Semantic Versioning also requires the contents of a published version to remain unchanged. Any changes must be published as a separate version. If a breaking change is released by mistake, the standard describes fixing the issue and publishing a version that restores compatibility. It also calls for documenting the affected version and notifying users where appropriate.

Create GitHub release notes

GitHub Docs describes automatic release notes as an alternative to writing them by hand. Generated notes include merged pull requests, release contributors, and a link to the full changelog. Repository collaborators and people with write access to the repository can generate and customize these notes.

From the repository’s main page on GitHub, select Releases, then Draft a new release. Use the Choose a tag menu to select an existing tag or create one. If you create a tag, use the Target menu to select the branch that contains the project you want to release. You can also use the Previous tag menu to select the tag that identifies the previous release.

Enter a title in the Release title field, then select Generate release notes above the description field. GitHub Docs recommends reviewing the generated notes to make sure they include everything you want to share and omit anything you want to leave out. Select Publish release if the release is ready or Save draft if you plan to work on it later.

GitHub also lets you attach binary files to a release. Select This is a pre-release to let users know the release may be unstable and is still unsuitable for production use. If GitHub Discussions is enabled for the repository, you can create a discussion for the release and choose a category.

According to GitHub Docs, if immutable releases are enabled for the repository, creating a draft first lets you attach all the files before the release becomes immutable. Published and draft releases are visible in the repository’s releases feed.

Customize the contents of generated notes

GitHub’s automatically generated release notes support categories based on pull request labels. You can also configure the notes to exclude specific labels and users. GitHub Docs explains how to do this by creating a .github/release.yml file in the repository and writing the settings in YAML.

To create the file in the GitHub interface, select Add file above the file list on the repository’s main page, then select Create new file. Enter .github/release.yml in the file name field. GitHub Docs notes that this creates the release.yml file in the .github directory.

changelog.exclude.labels lists the labels that identify pull requests to omit from the release notes. changelog.exclude.authors lists the login names of users or bots whose pull requests should be excluded.

changelog.categories[*].title is the required title for a change category in the release notes. changelog.categories[*].labels is also required and specifies which labels qualify a pull request for the category. GitHub Docs says you can use * for pull requests that do not match any of the preceding categories.

Use changelog.categories[*].exclude.labels and changelog.categories[*].exclude.authors to configure exclusions for a category. The first excludes pull requests with specific labels from that category. The second excludes pull requests by the specified users or bots.

Limitations

Keep a Changelog notes that a changelog generated with GitHub Releases is viewable within GitHub and is not portable. You can also create GitHub release notes by adding handwritten notes to Git tags or using messages from annotated tags.

Changelogs can be difficult to parse automatically because they use different file names and formats. According to Keep a Changelog, Vandamme, a Ruby gem developed by the Gemnasium team, can parse many changelogs from open projects, though its coverage is incomplete.

Ready to start?

Download the app and continue from your phone.

End of Entry