182
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 07 Oct 2024
182 points (98.4% liked)
Linux
5324 readers
223 users here now
A community for everything relating to the linux operating system
Also check out !linux_memes@programming.dev
Original icon base courtesy of lewing@isc.tamu.edu and The GIMP
founded 1 year ago
MODERATORS
A while ago, I wrote a tool to generate change logs from commit messages. It grabs all commits from a tag to the previous tag, and collates them into a Keep A Changelog format.
An unintended consequence is this is that my commit messages are in keepachangelog format; the tool just groups messages by type and adds the version and date decoration, and then inserts the text at the right place in the file.
It's fantastic. Because I know the commit messages will end up in the changelog, it encourages me to describe the commits in terms of:
Anything that doesn't start with a keyword is discarded, so I can still jot notes in the commit, but by far the biggest benefit is that it's completely broken me of the habit of reiterating the code change that I committed, and write the reason for the commit in descriptive language.
Having a little reinforcement such as tooling can do wonders for building good habits.
Postscript I don't know if anyone cares about this -- it's pretty specific to my workflow, but if you want to see the tool, it's just a shell script. The only non-standard tool it needs is ripgrep. You pipe some set of commit logs to it, and it collates them into sections. In the repo is a very Mercurial+bookmarks function that'll automatically grab and generate a section for the latest bookmark. But it boils down to something like this:
I only use git when I absolutely have to, so I don't know what the equivalent command for that is; but here:
-v
because I want the full commit. For a given commit, if there are multiple changes, I put each on its own line. Both git and hg only print the first line of each commit message by default, so to get all lines of commit log messages with Mercurial,-v
is needed.-r v0.0.4:v0.0.3
generates logs in reverse chronological order, from the commit with bookmarkv0.0.4
to the one with bookmarkv0.0.3
. This should work with tags, too.-P v0.0.3
prunes thev0.0.3
commit, so that its message doesn't get included with thev0.0.4
log entry.