website/blog/git-cliff-2.9.0.md
git-cliff is a command-line tool that provides a highly customizable way to generate changelogs from the Git history.
Started from the cd69e764f68e5f09cf6e14975e6a876cdccbcfb9, now we're here.
<details> <summary>Click here for the star history</summary> </details>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!
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! โฐ๏ธ๐งก
The full changelog can be found here.
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!
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.
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!
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
:::
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!
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
false, the commits will be sorted in the order they were committed, without considering their parent-child relationships.
git log.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.
git log --topo-order.Check out the new blog posts from the community members:
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.
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!
If you liked git-cliff and/or my other projects on GitHub, consider donating to support my open source endeavors.
Have a fantastic day! โฐ๏ธ