💾 Archived View for idiomdrottning.org › automatic-commit-message-formatting captured on 2024-02-05 at 09:42:05. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-11-14)

-=-=-=-=-=-=-

Automatic commit message formatting

For just jamming off tiny drive-by changes in a git repo, I often don’t bother whipping out magit and instead use a couple of shell scripts and they take a commit message right there on the command line.

Today I finally modded them to also jam that commit message through

sed 's/\.  */\n\n/'|fmt -w 72

So “Apply changes. Turns out this was needed after all. Because of the frobnication, otherwise things borked royally.” will be read as

Apply changes

Turns out this was needed after all. Because of the frobnication,
otherwise things borked royally.

Before I made this change, I was doing fine when it was only a couple of words, and if I need to write and format more detailedly I might as well open up magit or something, but when it’s almost a couple of words, just a few sentences, that’s where I’ve been struggling.

Which sucks because “just a few sentences” is so often a sweet spot.

The struggle was threefold:

1. Keep the header under fifty characters.

2. Don’t make the body lines longer than 72 characters.

3. But since I was eyeballing them, I often made them too short, or uneven, or both, or still too long, etc etc.

Now, that first one is still a concern (maybe I’ll fix that later), but the other two was where I were the most neurotic and it’s such a relief to not have to worry about that any more.

Also I used to manually elide the period and add two newlines, now I just make a new sentence which, to me at least, is easier.

PS. Contributors to my stuff, don’t worry. I’m not a stickler for this on my own repos. I did this change today to make it more easier for me to contribute to other repos.