Skip to main content

What's new in 2.9.0? ๐Ÿ†•

ยท 5 min read
Orhun Parmaksฤฑz
Author of git-cliff

git-cliff is a command-line tool that provides a highly customizable way to generate changelogs from the Git history.


10k Stars! ๐ŸŒŸโ€‹

Started from the cd69e764f68e5f09cf6e14975e6a876cdccbcfb9, now we're here.

Click here for the star history

star history

git-cliff has reached a whopping 10000 stars on GitHub and I wanted to celebrate this huge milestone with giving away a limited edition T-shirt!

giveaway

You can join the giveaway by clicking here. Nothing else is required!

If you want to buy the T-shirt and support the project, visit our shop at Grindhouse for different sizes and colors!

Thank you all for the support and love you have shown to git-cliff! โ›ฐ๏ธ๐Ÿงก


What's new? โ›ฐ๏ธโ€‹

The full changelog can be found here.


๐ŸŒ€ Submodule Supportโ€‹

git-cliff now supports submodules! You can recurse into submodules and generate changelogs for them as well.

Just set the following option in your configuration file:

[git]
recurse_submodules = true

And then you can use the submodule_commits template variable to access the commits of submodules as follows:

[changelog]
body = """
{% for submodule_path, commits in submodule_commits %}
### {{ submodule_path | upper_first }}
{% for group, commits in commits | group_by(attribute="group") %}
#### {{ group | upper_first }}
{% for commit in commits %}
- {{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}
{% endfor %}\n
"""

Thanks @lehmanju for the implementation in #1082!


โš ๏ธ Conventional commit checkโ€‹

git-cliff can now check if the commits in the repository follow the conventional commits specification.

To enable this check, set the require_conventional option in your configuration file:

[git]
require_conventional = true

If any unconventional commits are found, an error will be thrown and the changelog generation will fail.


๐Ÿ›ฐ๏ธ Remote configโ€‹

Have a configuration file elsewhere on the internet? No probs.

$ git cliff --config-url https://github.com/orhun/git-cliff/blob/main/examples/github-keepachangelog.toml?raw=true

The new --config-url option allows you to specify a URL to a configuration file!


โ†”๏ธ Commit range variableโ€‹

The template context now includes a commit_range variable that contains the range of commits that were used to generate the changelog.

Can be used as follows:

{{ commit_range.from }}..{{ commit_range.to }}

Results in:

a140cef0405e0bcbfb5de44ff59e091527d91b38..a9d4050212a18f6b3bd76e2e41fbb9045d268b80
tip

You can use the truncate filter to shorten the commit range:

{{ commit_range.from | truncate(length=7, end="") }}..{{ commit_range.to | truncate(length=7, end="") }}

Results in:

a140cef..a9d4050

๐ŸŒฟ Better branch supportโ€‹

git-cliff used to only support the default branches of the remotes (e.g., main branch on GitHub).

Now, it can fetch commits from the correct branch automatically based on the commit range that you provide.

For example:

$ git cliff v1.0.0..v1.0.1 --github-repo my-org/my-private-repo

This command used to default to the main branch of the my-org/my-private-repo repository. Now, it will use the v1.1 branch thus using the correct commits for the changelog.

Similarly:

$ git cliff 9f66ac0f76..89de5e8e50 --gitlab-repo my-org/my-private-repo

The changelog will contains commits up to the commit 89de5e8e50.

Thanks to @william-stacken for the implementation in #1086!


๐Ÿ”ข Disable topological sortingโ€‹

The topological sorting of commits can now be disabled by setting the topological_sort option to false in your configuration file:

[git]
topo_order_commits = false
  • If false, the commits will be sorted in the order they were committed, without considering their parent-child relationships.
    • This is equivalent to running git log.
  • Otherwise, if true (default), the commits will be sorted topologically, which means that the commits will be ordered in such a way that all parent commits come before their children.
    • This is equivalent to running git log --topo-order.

๐Ÿ“ New blog postsโ€‹

Check out the new blog posts from the community members:


๐Ÿ›ก๏ธ Remove tj-actionsโ€‹

There was a security issue reported in the tj-actions organization.

There is also a GitHub Action created for git-cliff: tj-actions/git-cliff.

The action seems to be unaffected by the compromise, but I have removed all the references to it from the documentation and the website for safety.


๐Ÿ› Various Bug Fixesโ€‹

  • (bump) Check the next version against tag_pattern regex (#1070) - (c4f0d28)
  • (bump) Accept lowercase values for bump_type config (#1101) - (77632b2)
  • (git) Handle worktrees while retrieving the path of repository (#1054) - (fab02b0)
  • (remote) Fix detection of GitLab merge request sha if commits were squashed (#1043) - (5f3a3d0)
  • (submodules) Fix submodules handling when using custom range (#1136) - (451a694)
  • (template) Correctly serialize JSON for the commit fields (#1145) - (e981e1d)

๐Ÿงฐ Otherโ€‹

  • (project) Migrate to Rust 2024 edition (#1128) - (4445f06)
  • (config) Initialize config structs with default values (#1090) - (9e4bd07)
  • (quickstart) Clarify git-cliff command (#1051) - (cd26bb2)
  • (security) Extend security policy (#1142) - (4c3c946)

New Contributors โค๏ธโ€‹

  • @ognis1205 made their first contribution in #1145
  • @janderssonse made their first contribution in #1142
  • @jdrst made their first contribution in #1138
  • @lehmanju made their first contribution in #1136
  • @Jean-Beru made their first contribution in #1132
  • @william-stacken made their first contribution in #1086
  • @SebClapie made their first contribution in #1121
  • @okydk made their first contribution in #1051

Any contribution is highly appreciated! See the contribution guidelines for getting started.

Feel free to submit issues and join our Discord / Matrix for discussion!

Follow git-cliff on Twitter & Mastodon to not miss any news!

Support ๐ŸŒŸโ€‹

If you liked git-cliff and/or my other projects on GitHub, consider donating to support my open source endeavors.

Have a fantastic day! โ›ฐ๏ธ

What's new in 2.8.0?

ยท 3 min read
Orhun Parmaksฤฑz
Author of git-cliff

git-cliff is a command-line tool (written in Rust) that provides a highly customizable way to generate changelogs from git history.

It supports using custom regular expressions to alter changelogs which are mostly based on conventional commits. With a single configuration file, a wide variety of formats can be applied for a changelog, thanks to the Jinja2/Django-inspired template engine.

More information and examples can be found in the GitHub repository.

What's new? โ›ฐ๏ธโ€‹

Happy new year! This version of git-cliff comes with quality of life improvements and bug fixes.

The full changelog can be found here.


๐Ÿ”ฅ Improved Monorepo Supportโ€‹

There were numerous improvements to the monorepo support in this release:

  1. git-cliff now discovers the Git repositories automatically even though when you run from sub directories.

  2. The configuration file is now automatically found when running from a sub directory.

  3. The include-path is now automatically set to the current directory when running from a sub directory.

As a result, the following command:

$ cd packages/some_library

$ git cliff --include-path "packages/some_library/**/*" --repository "../../"

becomes:

$ cd packages/some_library

$ git cliff # just works!

๐Ÿ›ก๏ธ Native TLS Supportโ€‹

git-cliff now supports enabling native TLS for remote requests. This is useful when you rely on a corporate trust root (e.g., for a mandatory proxy) that's included in your system's certificate store.

To enable it:

$ git cliff --use-native-tls

Or configure it in your cliff.toml:

[remote.gitlab]
owner = "archlinux"
repo = "arch-repro-status"
api_url = "https://gitlab.archlinux.org/api/v4"
native_tls = true

โš™๏ธ Custom Config Nameโ€‹

You can now specify a custom filename for the configuration while initializing git-cliff:

$ git-cliff --init --config custom.toml

๐Ÿšจ Better Errorsโ€‹

Before:

$ git cliff test
ERROR git_cliff > Git error: `unable to parse OID - contains invalid characters; class=Invalid (3)`

After:

$ git cliff test
ERROR git_cliff > Failed to set the commit range: unable to parse OID - contains invalid characters; class=Invalid (3)
"test" is not a valid commit range. Did you provide the correct arguments?

๐Ÿ”„ Run with Callback APIโ€‹

If you are using git-cliff in your Rust project as a library, you can now run it with a callback function to modify the changelog before it's printed:

use clap::Parser;
use git_cliff::args::Opt;
use git_cliff_core::error::Result;

fn main() -> Result<()> {
let args = Opt::parse();

git_cliff::run_with_changelog_modifier(args, |changelog| {
println!("Releases: {:?}", changelog.releases);
Ok(())
})?;

Ok(())
}

๐Ÿงฐ Otherโ€‹

  • (config) Allow environment overwrites when using builtin config (#961) - (7ba3b55)
  • (remote) Fix detection of GitLab merge request sha (#968) - (1297655)
  • (tips) Extend the merge commit filter example (#963) - (09c0f90)
  • (build) Bump MSRV to 1.83.0 - (37598c2)

Contributions ๐Ÿ‘ฅโ€‹

  • @xsadia made their first contribution in #992
  • @chenrui333 made their first contribution in #1002
  • @hackenbergstefan made their first contribution in #968
  • @paul-uz made their first contribution in #963
  • @jmartens made their first contribution in #959

Any contribution is highly appreciated! See the contribution guidelines for getting started.

Feel free to submit issues and join our Discord / Matrix for discussion!

Follow git-cliff on Twitter & Mastodon to not miss any news!

Support ๐ŸŒŸโ€‹

If you liked git-cliff and/or my other projects on GitHub, consider donating to support my open source endeavors.

Have a fantastic day! โ›ฐ๏ธ

What's new in 2.7.0?

ยท 5 min read
Orhun Parmaksฤฑz
Author of git-cliff

git-cliff is a command-line tool (written in Rust) that provides a highly customizable way to generate changelogs from git history.

It supports using custom regular expressions to alter changelogs which are mostly based on conventional commits. With a single configuration file, a wide variety of formats can be applied for a changelog, thanks to the Jinja2/Django-inspired template engine.

More information and examples can be found in the GitHub repository.

What's new? โ›ฐ๏ธโ€‹

The full changelog can be found here.


๐Ÿฅ‹ Jujutsu Supportโ€‹

git-cliff now supports opening a repository that has been cloned using Jujutsu!

For example:

$ jj git clone --colocate https://github.com/orhun/git-cliff

$ cd git-cliff

$ git cliff # works!
caution

This works differently with colocated and non-colocated repositories. See the documentation for more information.

tip

Watch my first live reaction to Jujutsu on this stream: Learning Jujutsu (a version control system)


โ˜˜๏ธ Add missing fields to contextโ€‹

A bug causing some fields such as footer to be missing in the context JSON has been fixed.

This means that the following command now yields an identical result with git-cliff:

# hey look, a snake eating its own tail! ๐Ÿ
git cliff --context | git cliff --from-context

๐Ÿ“ฉ Raw message in contextโ€‹

The context now contains the raw/unprocessed full commit message in the raw_message field. For example:

{
"version": "v0.1.0-rc.21",
"message": "The annotated tag message for the release",
"commits": [
{
"raw_message": "<type>[scope]: <description>\n[body]\n[footer(s)]"
}
]
}

You can use it like so:

{% for commit in commits %}
{{ commit.raw_message }}
{% endfor %}

โš™๏ธ Remote API URL configurationโ€‹

In addition to the command-line/environment variables, you can now override the remote API URL in the configuration file as follows:

[remote.gitlab]
owner = "archlinux"
repo = "arch-repro-status"
api_url = "https://gitlab.archlinux.org/api/v4" # new!

This is useful when you have a self-hosted Git service and want to use the API for fetching metadata.

See the remote configuration for more information.


โœจ Preserve first time contributorsโ€‹

There was a bug causing the first time contributors to be removed from the changelog when there was a new release. This has been fixed and now the first time contributors are preserved in the changelog.

So if you run git cliff now, you might get new names in the changelog! Don't be surprised.

See this pull request for more details.


๐Ÿ‹ ARM Docker imagesโ€‹

We brought back the Docker images for ARM64! ๐ŸŽ‰ See them here.

docker run --platform linux/arm64 -t -v "$(pwd)":/app/ "orhunp/git-cliff:${TAG:-latest}"

There was a problem building these images due to the timeouts in the GitHub Actions workflow. This turned out to be a problem related to needlessly fetching the Rust toolchain in the build step of cargo-chef and is now fixed in this pull request.

See the related discussion here.


โ„๏ธ Nix environmentโ€‹

We now have a basic and reproducible dev environment using Nix along with CI checks for it!

Here is the Nix flake and you can use it by running nix build and nix run commands.


๐ŸŽจ Colored helpโ€‹

A small cosmetic change, but the output of git cliff --help is now colorful!

Try it for yourself :)


๐Ÿ’– User testimonialsโ€‹

Do you like git-cliff? Spread the word on social media and let me know your thoughts! I will be featuring your testimonials.

I collected the testimonials that I could find so far and added them to the website. It picks one randomly on each page load.

Shoutout to those amazing people!


๐Ÿš€ Stabilize remote integrationโ€‹

The remote integration with GitHub/GitLab/Gitea/Bitbucket has been stabilized and now works as expected (apart from a couple of bugs that come and go occasionally).


๐Ÿงฐ Otherโ€‹

  • (log) Add trace log about which command is being run - (a9b2690)
  • (bitbucket) Match PR and release metadata correctly (#907) - (e936ed5)
  • (changelog) Include the root commit when --latest is used with one tag (#901) - (508a97e)
  • (config) Add the 'other' parser to the default config - (12cb1df)
  • (git) Improve docs for commit_preprocessors and commit_parsers (#928) - (c1f1215)

Contributions ๐Ÿ‘ฅโ€‹

  • @pauliyobo made their first contribution in #896
  • @blackheaven made their first contribution in #939
  • @Muhammad-Owais-Warsi made their first contribution in #928
  • @kemitix made their first contribution in #930
  • @mcwarman made their first contribution in #925
  • @LtdSauce made their first contribution in #919
  • @dqkqd made their first contribution in #920
  • @gsquire made their first contribution in #909
  • @rarescosma made their first contribution in #901
  • @vsn4ik made their first contribution in #894

Any contribution is highly appreciated! See the contribution guidelines for getting started.

Feel free to submit issues and join our Discord / Matrix for discussion!

Follow git-cliff on Twitter & Mastodon to not miss any news!

Support ๐ŸŒŸโ€‹

If you liked git-cliff and/or my other projects on GitHub, consider donating to support my open source endeavors.

Have a fantastic day! โ›ฐ๏ธ

What's new in 2.6.0?

ยท 3 min read
Orhun Parmaksฤฑz
Author of git-cliff

git-cliff is a command-line tool (written in Rust) that provides a highly customizable way to generate changelogs from git history.

It supports using custom regular expressions to alter changelogs which are mostly based on conventional commits. With a single configuration file, a wide variety of formats can be applied for a changelog, thanks to the Jinja2/Django-inspired template engine.

More information and examples can be found in the GitHub repository.

What's new? โ›ฐ๏ธโ€‹

The full changelog can be found here.


๐Ÿ› ๏ธ Deprecated integration fieldsโ€‹

The following fields are deprecated and will be removed in the next releases:

  • commit.github, commit.gitea, commit.gitlab, commit.bitbucket

You can now use the commit.remote field instead. For example:

-{% if commit.github.username %}
+{% if commit.remote.username %}

๐ŸŒฒ Better branch supportโ€‹

If you have diverged branches for your project and want to changelog for each branch, you can now use the --use-branch-tags option.

$ git cliff --use-branch-tags

The generated changelog above will only include the tags from the current branch.

Also, you can use it from the configuration file:

[git]
use_branch_tags = true
info

See the implementation for more explanation and the coolest hand-drawn diagram ever!


โ™พ๏ธ Render alwaysโ€‹

Do you want to always render the changelog even if there are no changes? Boom, now you can now use the render_always option:

[changelog]
render_always = true

๐Ÿ“ค Output from configurationโ€‹

This is pretty self-explanatory:

[changelog]
output = "CHANGELOG.md"

This option does not take precedence over command-line arguments which means you can override it with the --output option.


๐Ÿ“ฆ Improve Typescript APIโ€‹

We added the missing options and documented all options with tsdoc comments.

Also, we improved the skipCommit option to accept an array of values.

info

See the implementation for more information.


โœ‚๏ธ Trim commit messagesโ€‹

We now remove the trailing newline for commits, which means you can use $ anchor in your regular expressions:

[git]
commit_preprocessors = [
# remove the issue number at the end of the commit message (e.g. #123)
{ pattern = ' #\d+$', replace = ""}
]

๐ŸŒŸ Better example templatesโ€‹

The example templates are now more intuitive and conventionally correct. We removed the non-beginner-friendly options and changed the defaults to be easier to start with. Weheee!


๐Ÿงฐ Otherโ€‹

  • (template) [breaking/core] Add name parameter to the constructor - (e577113)
  • (bump) Suppress template warning when --bumped-version is used (#855) - (8bebbf9)
  • (changelog) Do not change the tag date if tag already exists (#861) - (fbb643b)
  • (changelog) Correctly set the tag message for the latest release (#854) - (e41e8dd)
  • (changelog) Don't change the context when provided via --from-context (#820) - (ff72406)

Contributions ๐Ÿ‘ฅโ€‹

  • @nejcgalof made their first contribution in #853
  • @pplmx made their first contribution in #824

Any contribution is highly appreciated! See the contribution guidelines for getting started.

Feel free to submit issues and join our Discord / Matrix for discussion!

Follow git-cliff on Twitter & Mastodon to not miss any news!

Support ๐ŸŒŸโ€‹

If you liked git-cliff and/or my other projects on GitHub, consider donating to support my open source endeavors.

Have a fantastic day! โ›ฐ๏ธ

What's new in 2.5.0?

ยท 6 min read
Orhun Parmaksฤฑz
Author of git-cliff

git-cliff is a command-line tool (written in Rust) that provides a highly customizable way to generate changelogs from git history.

It supports using custom regular expressions to alter changelogs which are mostly based on conventional commits. With a single configuration file, a wide variety of formats can be applied for a changelog, thanks to the Jinja2/Django-inspired template engine.

More information and examples can be found in the GitHub repository.

What's new? โ›ฐ๏ธโ€‹

The full changelog can be found here.


๐Ÿ”ฅ Generate changelog from contextโ€‹

Meet our powerful new command-line argument: --from-context.

# create a context
$ git cliff --context -o context.json

# generate changelog from context
$ git cliff --from-context context.json

This new extension point allows transformations on the context and can be especially useful when preprocessor/postprocessor/linkprocessor capabilities are limited.

One example use case is:

  1. Print context
  2. Modify it with an external tool
  3. Pipe it back into git-cliff

If you need additional data in the changelog, you can also use the newly added extra free-form metadata in the context:

{
"id": "5061081d6272b1da2146fab49d803c193db309d9",
"message": "commit message",
"extra": {
"note": "this can be anything"
}
}

๐Ÿงฉ Grouping by arbitrary fieldsโ€‹

git-cliff now supports grouping commits by arbitrary context fields instead of just a limited set. This means that you can use any context field for commit_parsers as field.

For example, to group by GitHub PR labels:

[git]
commit_parsers = [
{ field = "github.pr_labels", pattern = "breaking-change", group = "<!-- 0 --> ๐Ÿ—๏ธ Breaking changes" },
{ field = "github.pr_labels", pattern = "type/enhancement", group = "<!-- 1 --> ๐Ÿš€ Features" },
{ field = "github.pr_labels", pattern = "type/bug", group = "<!-- 2 --> ๐Ÿ› Fixes" },
{ field = "github.pr_labels", pattern = "type/update", group = "<!-- 3 --> ๐Ÿงช Dependencies" },
{ field = "github.pr_labels", pattern = "type/refactor", group = "<!-- 4 --> ๐Ÿญ Refactor" },
{ field = "github.pr_labels", pattern = "area/documentation", group = "<!-- 5 --> ๐Ÿ“ Documentation" },
{ field = "github.pr_labels", pattern = ".*", group = "<!-- 6 --> ๐ŸŒ€ Miscellaneous" },
]

See the commit_parsers documentation for more information.


โฌ†๏ธ Bump specific versionsโ€‹

Now you can specify the semver type while using --bump:

$ git cliff --bump [major|minor|patch]

See the bump documentation for more information.


โšก Gotta go fastโ€‹

git-cliff now runs 258x faster for --include-path/--exclude-path arguments thanks to caching the commit retain checks.

Now: 0.080 s
Before: 20.633 s

We also improved handling of include/exclude patterns (e.g., by considering the first commit).

See the implementation for cool flamegraphs and more!


๐Ÿ’ฏ Performance profilingโ€‹

git-cliff now supports building with performance profiling instrumentation, which helps identify bottlenecks.

To create a flame graph SVG:

$ cargo run --profile=bench --features=profiler

See the documentation for more information.


โš—๏ธ Better integration activationโ€‹

Before this change, the only way to activate a remote integration (and fetch remote data) was by incorporating the related variables in a template.

This meant that the changelog context wouldn't contain GitHub-related fields unless you used something like github.contributors in your template.

Now weโ€™ve added support for enabling the remote integration in the following cases:

  • If the [remote] table is configured.
  • If the remote is set via command-line arguments (e.g., --github-repo).

So, the following output will contain GitHub variables even with the default template (since the remote is set):

$ git cliff --context --github-repo orhun/git-cliff

Additionally, we fixed a bug where some of the GitHub-related variables were not recognized in the template.


๐Ÿ”ข count_tagsโ€‹

A new configuration option has been added to the [git] section!

[git]
count_tags = "v.*-beta.*"
info

count_tags works like an inverted version of ignore_tags, including all the commits but only counting the specific tags.

See the implementation for more details and an example use case.


๐Ÿ† KaiCode: Open Source Festivalโ€‹

git-cliff won a prize for finishing second place in the KaiCode Open Source Festival!

The orhun/git-cliff project (8.3Kโ˜…), a customizable changelog generator, impressed us with its excellent easy-to-read source code, build pipeline organization, integration testing, and active issue triaging. However, code coverage is rather low, some functions are too long, there is a lack of peer reviews, and a lack of clarity in the repository structure. $1024 was the reward.


๐ŸฆŠ GitLab integration fixesโ€‹

  • (gitlab) URL-encode the owner in remote requests for GitLab (#742) - (e3e7c07)
  • (args) Allow GitLab groups with --gitlab-repo (#807) - (6fbfdb5)

๐Ÿงฐ Otherโ€‹

  • (changelog) Skip ssh and x509 signatures in tag messages (#748) - (ecbabbf)
  • (changelog) Allow using --bumped-version without conventional commits (#806) - (e74080c)
  • (config) Allow using environment variables without config file present (#783) - (2471745)
  • (config) Make example templates more user-friendly - (6f8ea19)
  • (lib) Clean up some code (#709) - (4b0c0eb)

Contributions ๐Ÿ‘ฅโ€‹

  • @oberrich made their first contribution in #809
  • @tisonkun made their first contribution in #599
  • @DerTiedemann made their first contribution in #758
  • @DaniPopes made their first contribution in #709
  • @artrz made their first contribution in #779
  • @braineo made their first contribution in #744
  • @myl7 made their first contribution in #776
  • @pawamoy made their first contribution in #774
  • @tonybutt made their first contribution in #742
  • @PigeonF made their first contribution in #748
  • @janbuchar made their first contribution in #784
  • @weichweich made their first contribution in #807

Any contribution is highly appreciated! See the contribution guidelines for getting started.

Feel free to submit issues and join our Discord / Matrix for discussion!

Follow git-cliff on Twitter & Mastodon to not miss any news!

Support ๐ŸŒŸโ€‹

If you liked git-cliff and/or my other projects on GitHub, consider donating to support my open source endeavors.

Have a fantastic day! โ›ฐ๏ธ

What's new in 2.4.0?

ยท 6 min read
Orhun Parmaksฤฑz
Author of git-cliff

git-cliff is a command-line tool (written in Rust) that provides a highly customizable way to generate changelogs from git history.

It supports using custom regular expressions to alter changelogs which are mostly based on conventional commits. With a single configuration file, a wide variety of formats can be applied for a changelog, thanks to the Jinja2/Django-inspired template engine.

More information and examples can be found in the GitHub repository.

What's new? โ›ฐ๏ธโ€‹

The full changelog can be found here.


๐Ÿต Gitea Integrationโ€‹

git-cliff now supports integrating with repositories hosted on Gitea (e.g. Codeberg or your own instance!)

This means that you can now use the following variables in your changelog:

  • Usernames (${{ commit.gitea.username }} or ${{ contributor.username }})
  • Contributors list (${{ gitea.contributors }})
  • Pull requests (${{ commit.gitea.pr_number }} or ${{ contributor.pr_number }})

This means you can generate changelog entries like the following:

## What's Changed

- feat(commit): add merge_commit flag to the context by @orhun in #389
- test(fixture): add test fixture for bumping version by @orhun in #360

## New Contributors

- @someone made their first contribution in #360
- @cliffjumper made their first contribution in #389

<!-- generated by git-cliff -->

To set up git-cliff for your project, simply:

  1. Check out the quickstart guide for installation / initialization.
  2. Set up the Git remote for your GitLab project.
  3. Update the changelog configuration to use the template variables.
tip

See the Gitea integration for detailed documentation and usage examples. It works very similar to the GitHub integration.


๐Ÿ“ค Bump based on patternโ€‹

The --bump argument works as follows:

  • "fix:" -> increments PATCH
  • "feat:" -> increments MINOR
  • "scope!" (breaking changes) -> increments MAJOR

But what happens let's say you want to bump the major if the commit starts with "abc" instead?

Good news, git-cliff now supports bumping based on configurable custom patterns! Simply configure the following values in your configuration:

[bump]
custom_major_increment_regex = "abc"
custom_minor_increment_regex = "minor|more"

So with this commit history:

(HEAD -> main) abc: 1
(tag: 0.1.0) initial commit

The major will be bumped due to "abc" (0.1.0 -> 1.0.0)

$ git-cliff --bumped-version

1.0.0

โฌ†๏ธ Set initial tag for bumpโ€‹

When using --bump, if there are no initial tags are found then the default used to be hardcoded as 0.1.0.

Now you can configure this value in the configuration file as follows:

[bump]
initial_tag = "1.0.0"

You can also override this value from the command line as follows:

$ git-cliff --bump --tag=1.0.0

โš™๏ธ --ignore-tags argumentโ€‹

The value of [git.ignore_tags] can now be overridden by the newly added --ignore-tags argument:

$ git-cliff --ignore-tags "rc|v2.1.0|v2.1.1"

is the equivalent of:

[git]
# regex for ignoring tags
ignore_tags = "rc|v2.1.0|v2.1.1"

๐Ÿ“ Header templateโ€‹

[changelog.header] is now a template similar to body and footer. It used to be a raw string value that is added to the top of the changelog but now you can use the template variables and functions in it!

For example:

[changelog]
# template for the changelog footer
header = """
# Changelog
{% for release in releases %}\
{% if release.version %}\
{% if release.previous.version %}\
<!--{{ release.previous.version }}..{{ release.version }}-->
{% endif %}\
{% else %}\
<!--{{ release.previous.version }}..HEAD-->
{% endif %}\
{% endfor %}\
"""

Will result in:

# Changelog

<!--v3.0.0..HEAD-->
<!--v0.2.0..v3.0.0-->
<!--v0.1.0..v0.2.0-->
There is a pending issue that needs fixing for --prepend to work with header template.

You can now parse the commits by their footer value!

Let's say you want to skip this commit:

git commit -m "test: add more tests" -m "changelog: ignore"

This is now possible:

[git]
# regex for parsing and grouping commits
commit_parsers = [
{ footer = "^changelog: ?ignore", skip = true },
]

๐Ÿ“ฉ Support tag messagesโ€‹

You can now include the tag messages (of release tags) in your changelog!

This can be useful for having "headlines" for a release like so:

## [1.0.1] - 2021-07-18

This is the release-tag message

The message is available in the context of the template as the {{ message }} variable:

{% if message %}
{{ message }}
{% endif %}\

You can also override the tag message for the unreleased changes via --with-tag-message argument as follows:

$ git cliff --bump --unreleased --with-tag-message "This is the release-tag message"

The recommended way of setting tag messages is to use annotated tags in your project:

$ git tag v1.0.0 -m "This is the release-tag message"

๐Ÿ“‚ Repository path in contextโ€‹

You can now use {{ repository }} variable in the template to get the repository path:

## Release [{{ version }}] - {{ timestamp | date(format="%Y-%m-%d") }} - {{ repository }}

This is especially useful when you use git-cliff with multiple repositories. (e.g. git-cliff -r repo1 -r repo2)


๐Ÿ“ก Remote data in contextโ€‹

We updated the changelog processing order to make remote data (e.g. GitHub commits, pull requests, etc.) available in the context.

For example:

$ git cliff --github-repo orhun/git-cliff -c examples/github.toml --no-exec -u -x

This command will now contain the GitHub data such as:

 "github": {
"contributors": [
{
"username": "bukowa",
"pr_title": "style(lint): fix formatting",
"pr_number": 702,
"pr_labels": [],
"is_first_time": true
},
],
}

๐Ÿงฐ Otherโ€‹

  • (website) Add information about --bump with tag prefixes (#695) - (4cd18c2)
  • (fixture) Support running fixtures on mingw64 (#708) - (dabe716)

Contributions ๐Ÿ‘ฅโ€‹

  • @MeitarR made their first contribution in #713
  • @bukowa made their first contribution in #696
  • @Cyclonit made their first contribution in #698
  • @jan-ferdinand made their first contribution in #569
  • @Theta-Dev made their first contribution in #680
  • @tcarmet made their first contribution in #694

Any contribution is highly appreciated! See the contribution guidelines for getting started.

Feel free to submit issues and join our Discord / Matrix for discussion!

Follow git-cliff on Twitter & Mastodon to not miss any news!

Support ๐ŸŒŸโ€‹

If you liked git-cliff and/or my other projects on GitHub, consider donating to support my open source endeavors.

Have a fantastic day! โ›ฐ๏ธ

What's new in 2.3.0?

ยท 3 min read
Orhun Parmaksฤฑz
Author of git-cliff

git-cliff is a command-line tool (written in Rust) that provides a highly customizable way to generate changelogs from git history.

It supports using custom regular expressions to alter changelogs which are mostly based on conventional commits. With a single configuration file, a wide variety of formats can be applied for a changelog, thanks to the Jinja2/Django-inspired template engine.

More information and examples can be found in the GitHub repository.

What's new? โ›ฐ๏ธโ€‹

The full changelog can be found here.


๐ŸฆŠ GitLab Integrationโ€‹

git-cliff now supports integrating with repositories hosted on GitLab (gitlab.com or your own instance)!

This means that you can now use the following variables in your changelog:

  • GitLab usernames (${{ commit.gitlab.username }} or ${{ contributor.username }})
  • Contributors list (${{ gitlab.contributors }})
  • Pull requests (${{ commit.gitlab.pr_number }} or ${{ contributor.pr_number }})

Which means you can generate a changelog entries like the following:

## What's Changed

- feat(commit): add merge_commit flag to the context by @orhun in !389
- test(fixture): add test fixture for bumping version by @orhun in !360

## New Contributors

- @someone made their first contribution in !360
- @cliffjumper made their first contribution in !389

<!-- generated by git-cliff -->

To set up git-cliff for your project, simply:

  1. Check out the quickstart guide for installation / initialization.
  2. Set up the Git remote for your GitLab project.
  3. Update the changelog configuration to use the template variables.
tip

See the GitLab integration for detailed documentation and usage examples. It works very similar to the GitHub integration.

Big thanks to dark0dave for the contribution!


๐Ÿ“˜ Bitbucket Integrationโ€‹

git-cliff now supports integrating with repositories hosted on Bitbucket!

It works similarly with GitHub and GitLab integrations. See the documentation for details and usage examples.

Big thanks to dark0dave for the contribution!


๐Ÿ“ค Output to stdoutโ€‹

Using - for stdout is common among CLI tools and git-cliff now supports this!

$ git-cliff -o -

You can simply use - instead instead of -o /dev/stdout. It can also be used in conjunction with -p argument as mentioned in this issue.


๐Ÿงฐ Otherโ€‹

  • (nix) Add installation instructions for Nix (#669) - (63c8ad4)
  • (website) Add more git range examples (#655) - (d451252)
  • (args) Allow -o and -p together if they point to different files (#653) - (076f859)
  • (example) Allow using github template without github variables (#672) - (6a9feba)

Contributions ๐Ÿ‘ฅโ€‹

  • @R11baka made their first contribution in #672
  • @0x61nas made their first contribution in #669
  • @dark0dave made their first contribution in #663
  • @antonengelhardt made their first contribution in #653

Any contribution is highly appreciated! See the contribution guidelines for getting started.

Feel free to submit issues and join our Discord / Matrix for discussion!

Follow git-cliff on Twitter & Mastodon to not miss any news!

Support ๐ŸŒŸโ€‹

If you liked git-cliff and/or my other projects on GitHub, consider donating to support my open source endeavors.

Have a fantastic day! โ›ฐ๏ธ

What's new in 2.2.0?

ยท 4 min read
Orhun Parmaksฤฑz
Author of git-cliff

git-cliff is a command-line tool (written in Rust) that provides a highly customizable way to generate changelogs from git history.

It supports using custom regular expressions to alter changelogs which are mostly based on conventional commits. With a single configuration file, a wide variety of formats can be applied for a changelog, thanks to the Jinja2/Django-inspired template engine.

More information and examples can be found in the GitHub repository.

What's new? โ›ฐ๏ธโ€‹

The full changelog can be found here.

๐ŸŽˆ Configurable Bump Rulesโ€‹

If you are a frequent user of --bump/--bumped-version flags then this new feature is for you!

git-cliff now supports customizing the behavior of version bumps.

Add the following section to your cliff.toml for configuration:

[bump]
# Configures automatic minor version increments for feature changes.
#
# When true, a feature will always trigger a minor version update.
#
# When false, a feature will trigger:
# - a patch version update if the major version is 0.
# - a minor version update otherwise.
features_always_bump_minor = true

# Configures 0 -> 1 major version increments for breaking changes.
#
# When true, a breaking change commit will always trigger a major version update
# (including the transition from version 0 to 1)
#
# When false, a breaking change commit will trigger:
# - a minor version update if the major version is 0.
# - a major version update otherwise.
breaking_always_bump_major = true

๐Ÿ› ๏ธ Better Template Errorsโ€‹

Template rendering errors are now more verbose!

For example, let's throw an error in the template with using throw function:

[changelog]
body = """
{{ throw(message="something happened!") }}
"""

When you run git-cliff:

 ERROR git_cliff > Template render error:
Function call 'throw' failed
something happened!

๐Ÿค– Auto Detecting Configโ€‹

If you configured git-cliff from Cargo.toml via metadata table ([workspace.metadata.git-cliff.changelog]), running git cliff is now simply enough!

$ git cliff

# is same as
$ git cliff --config Cargo.toml

We also updated the config detection mechanism to support the following cases:

cliff.tomlproject manifest (e.g. Cargo.toml)use config from:
โœ…โœ…cliff.toml
โœ…โŒcliff.toml
โŒโœ…Cargo.toml
โŒโŒbuiltin

See Rust & Python integration for more information.


๐Ÿšฆ Commit Processing Orderโ€‹

The order of commit processing is changed from:

  1. Split commits
  2. Process commits

To:

  1. Process commits
  2. Split commits (and process the split commits)

This makes it possible to e.g. preprocess commits, split them by newline and then process each line as conventional commit.

See #555 for an example.


โœ‚๏ธ Trim Textโ€‹

We changed the commit parser behavior to always trim the text (commit message, body, etc.) before matching it with a regex.

This means that you will be able to use $ in the regex for matching until the end.

For example:

[git]
commit_parsers = [
{ message = '^(fix|feat|setup|doc|refactor|test|optimization)\([A-Za-z0-9_-]+?\))+(:\ .*)$', group = "test"},
]

๐Ÿš€ Quick Installation in CIโ€‹

You can now install git-cliff in your GitHub Actions CI easily with taiki-e/install-action!

- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install git-cliff
uses: taiki-e/install-action@git-cliff

- name: Generate changelog
run: git-cliff

๐Ÿงฐ Otherโ€‹

  • (changelog) Return the last version if there is nothing to bump - (45c87f2)
  • (command) Add missing environment variables for Windows (#532) - (9722784)
  • (npm) Publish rc version for prereleases (#528) - (16bea51)
  • (pypi) Update maturin version (#539) - (10b7ab8)

Contributions ๐Ÿ‘ฅโ€‹

Any contribution is highly appreciated! See the contribution guidelines for getting started.

Feel free to submit issues and join our Discord / Matrix for discussion!

Follow git-cliff on Twitter & Mastodon to not miss any news!

Support ๐ŸŒŸโ€‹

If you liked git-cliff and/or my other projects on GitHub, consider donating to support my open source endeavors.

Have a fantastic day! โ›ฐ๏ธ

What's new in 2.0.0?

ยท 7 min read
Orhun Parmaksฤฑz
Author of git-cliff

git-cliff is a command-line tool (written in Rust) that provides a highly customizable way to generate changelogs from git history.

It supports using custom regular expressions to alter changelogs which are mostly based on conventional commits. With a single configuration file, a wide variety of formats can be applied for a changelog, thanks to the Jinja2/Django-inspired template engine.

More information and examples can be found in the GitHub repository.

What's new? โ›ฐ๏ธโ€‹

The full changelog can be found here.

๐Ÿš€ GitHub Integrationโ€‹

This highly requested feature is now experimentally available with the 2.0.0 version of git-cliff!

For repositories hosted on GitHub, you can now use the following variables in your changelog:

  • GitHub usernames (${{ commit.github.username }} or ${{ contributor.username }})
  • Contributors list (${{ github.contributors }})
  • Pull requests (${{ commit.github.pr_number }} or ${{ contributor.pr_number }})

To quickly set things up for your project, you can use the built-in GitHub template:

# creates cliff.toml
$ git cliff --init github

And simply run git cliff to generate a changelog like the following:

## What's Changed

- feat(commit): add merge_commit flag to the context by @orhun in #389
- test(fixture): add test fixture for bumping version by @orhun in #360

## New Contributors

- @someone made their first contribution in #360
- @cliffjumper made their first contribution in #389

<!-- generated by git-cliff -->
tip

For detailed documentation and usage examples, check out the GitHub integration!


๐Ÿฆ€ RustLab 2023โ€‹

I gave a talk about git-cliff at RustLab 2023 - you can watch the recording here:


๐Ÿ“‹ Built-in Templatesโ€‹

As briefly mentioned, the example templates are now embedded into the binary which means you can quickly initialize git-cliff or generate a changelog using one of them.

# creates cliff.toml with keepachangelog template
$ git cliff --init keepachangelog
# generates a changelog in keepachangelog format
$ git cliff --config keepachangelog

Here is the full list of supported templates as of now:


Now you can use a template in [changelog.footer] as well!

Before:

# changelog footer
footer = """
<!-- generated by git-cliff -->
"""

After:

# template for the changelog footer
footer = """
<!-- generated by git-cliff at {{ now() | date(format="%Y-%m-%d") }} -->
"""

For example, keepachangelog.toml uses this for adding links to the end of the changelog.

# template for the changelog footer
footer = """
{% for release in releases -%}
{% if release.version -%}
{% if release.previous.version -%}
[{{ release.version | trim_start_matches(pat="v") }}]: \
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
/compare/{{ release.previous.version }}..{{ release.version }}
{% endif -%}
{% else -%}
[unreleased]: https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
/compare/{{ release.previous.version }}..HEAD
{% endif -%}
{% endfor %}
<!-- generated by git-cliff -->
"""

Results in:

[unreleased]: https://github.com/orhun/git-cliff/compare/v1.4.0..HEAD
[1.4.0]: https://github.com/orhun/git-cliff/compare/v1.3.1..v1.4.0
[1.3.1]: https://github.com/orhun/git-cliff/compare/v1.3.1-rc.0..v1.3.1
[1.3.1-rc.0]: https://github.com/orhun/git-cliff/compare/v1.3.0..v1.3.1-rc.0

๐Ÿงถ Improve Skippingโ€‹

Do you want to skip erroneous commits in the changelog? We now support two comfortable ways of doing that.

1. .cliffignoreโ€‹

You can now add a .cliffignore file at the root of your repository for listing the commits that will be skipped:

# skip commits by their SHA1

4f88dda8c746173ea59f920b7579b7f6c74bd6c8
10c3194381f2cc4f93eb97404369568882ed8677

2. --skip-commitโ€‹

You can skip commits by using this argument as follows:

$ git cliff --skip-commit 10c3194381f2cc4f93eb97404369568882ed8677 \
--skip-commit 4f88dda8c746173ea59f920b7579b7f6c74bd6c8

๐Ÿ–จ๏ธ Print Bumped Versionโ€‹

If you want to use the --bump option but are only interested in the bumped version instead of the entire changelog, you can simply use the newly added --bumped-version flag!

# print the next semantic version
$ git cliff --bumped-version

v2.0.0

๐Ÿšซ Disable Command Executionโ€‹

If you are using external commands (e.g. via replace_command) in your configuration, you can now entirely skip executing those commands with --no-exec flag.

$ git cliff --no-exec

For example, this is useful in the cases where the execution takes time.


๐Ÿ”„ Filter Merge Commitsโ€‹

The template context has a new field called merge_commit (bool) which can be used to filter out merge commits.

For example, you can use filter(attribute="merge_commit", value=false) as follows:

{% for group, commits in commits |
filter(attribute="merge_commit", value=false) |
group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- {{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}\n

๐Ÿ” Match by commit SHAโ€‹

It is now possible to use the SHA1 of a commit with commit_parsers.

For example, to skip a specific commit:

commit_parsers = [
{ sha = "f6f2472bdf0bbb5f9fcaf2d72c1fa9f98f772bb2", skip = true }
]

To override the group of a specific commit:

commit_parsers = [
{ sha = "f6f2472bdf0bbb5f9fcaf2d72c1fa9f98f772bb2", group = "Stuff" }
]

๐Ÿ”  Regex Scope Valuesโ€‹

It is now possible to use regex-replace for the scope value in commit_parsers:

[git]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^\\[(.*)\\]", group = "Changes to ${1}", scope = "${1}" },
]

In this example, [codebase]: rewrite everything in Rust will appear in the changelog as:

### Changes to codebase

- (codebase) Rewrite everything in Rust

๐Ÿ“ˆ Bump Improvementsโ€‹

There was some love towards --bump flag to improve its behavior:

  • Tag prefixes are now supported!
    • This means that for example if you have testing/v1.0.0-beta.1 as the current version and if you run git cliff --bump, you will see testing/v1.0.0-beta.2 in your changelog.
  • If no tags exist, --bump will yield 0.1.0 as default.
  • Other behavioral fixes!

๐Ÿ“š Documentation Improvementsโ€‹

brew install git-cliff

๐ŸŒ Website Improvementsโ€‹

  • Made dark theme default (sorry moths)
  • Added a search bar

๐Ÿงฐ Otherโ€‹

There were a lot of bug fixes and improvements in this release but mainly:

  • (changelog) Fix previous version links (#364)
  • (cli) Fix broken pipe when stdout is interrupted (#407)
  • (commit) Trim the trailing newline from message (#403)
  • (git) Sort commits in topological order (#415)
  • (args) Set CHANGELOG.md as default missing value for output option (#354)
  • (changelog) Disable the default behavior of next-version (#343)

Contributions ๐Ÿ‘ฅโ€‹

Any contribution is highly appreciated! See the contribution guidelines for getting started.

Feel free to submit issues and join our Discord / Matrix for discussion!

Follow git-cliff on Twitter & Mastodon to not miss any news!

Support ๐ŸŒŸโ€‹

If you liked git-cliff and/or my other projects on GitHub, consider donating to support my open source endeavors.

Have a fantastic day! โ›ฐ๏ธ

What's new in 1.4.0?

ยท 4 min read
Orhun Parmaksฤฑz
Author of git-cliff

git-cliff is a command-line tool (written in Rust) that provides a highly customizable way to generate changelogs from git history. It supports using custom regular expressions to alter changelogs which are mostly based on conventional commits. With a single configuration file, a wide variety of formats can be applied for a changelog, thanks to the Jinja2/Django-inspired template engine. More information and examples can be found in the GitHub repository.

What's new?โ€‹

The full changelog can be found here.

Bump version ๐Ÿ†™โ€‹

git-cliff can calculate the next version based on conventional commits and bump the version for the unreleased changes for you!

--bump: Bumps the version for unreleased changes

For example, if you have 1.0.0 and committed "feat: xyz", git-cliff --bump --unreleased will create a changelog for 1.1.0.

How it works is that for a semantic versioning such as <MAJOR>.<MINOR>.<PATCH>:

  • "fix:" -> increments PATCH
  • "feat:" -> increments MINOR
  • "scope!" (breaking changes) -> increments MAJOR

Better grouping ๐Ÿ‘ฅโ€‹

Now you can group commits by their attributes, i.e. name of the author, email, etc.

For example, to group the commits that belong to Dependabot under "Dependency Updates" in the changelog:

[git]
# regex for parsing and grouping commits
commit_parsers = [
{ field = "author.name", pattern = "dependabot\\[bot\\]", group = "Dependency Updates"},
]

This will result in:

### Dependency Updates

- _(deps)_ Bump regex from 1.9.6 to 1.10.0
- _(deps)_ Bump toml from 0.8.1 to 0.8.2
- _(deps)_ Bump regex from 1.9.5 to 1.9.6

The supported commit attributes (fields) are:

  • id
  • message
  • body
  • author.name
  • author.email
  • committer.email
  • committer.name

Glob -> Regex ๐Ÿงถโ€‹

[git].tag_pattern was only supporting glob patterns for matching (mostly due to the underlying support of such glob by git2), now it directly supports regular expressions:

[git]
- # glob pattern for matching git tags
+ # regex for matching git tags
- tag_pattern = "v[0-9]*"
+ tag_pattern = "v[0-9].*"

Auto-fix typos โœ๏ธโ€‹

Here is a git-cliff configuration for automatically fixing the typos in the commit messages before they appear in the changelog:

# regex for preprocessing the commit messages
commit_preprocessors = [
# Check spelling of the commit with https://github.com/crate-ci/typos
# If the spelling is incorrect, it will be automatically fixed.
{ pattern = '.*', replace_command = 'typos --write-changes -' },
]

This configuration was added to the git-cliff's repository config (not default) in #316 and runs typos for each commit. There is also a good first issue to improve this.

Emacs support ๐Ÿ˜ˆโ€‹

Check out git-cliff.el to generate, update and release changelog in Emacs.

RustLab 2023 ๐Ÿ“ขโ€‹

I'm happy to announce that I will be talking about git-cliff at RustLab 2023! ๐ŸŽ‰

rustlab2023

https://rustlab.it/talks/turning-git-commits-into-changelog-with-git-cliff

In this talk, I will be sharing the story behind git-cliff, implementation details with certain design choices, and most importantly how to work with Git objects using Rust. Also, I will be sharing examples of how to use git-cliff and integrate it with your project.

Additionally, I will be giving tips on creating a successful command-line tool in Rust and publishing it as open source.

Contributionsโ€‹

Any contribution is highly appreciated! There are contribution guidelines for getting started.

Feel free to submit issues and join Discord / Matrix!

If you liked git-cliff and/or my other projects on GitHub, consider donating to support my open source endeavors.

๐Ÿ’– https://donate.orhun.dev

Have a fantastic day! โ›ฐ๏ธ