I asked AI to write a commit message for me last week The code change was simple. A bug fix One line, easy to explain in a single sentence if I'd b...
For further actions, you may consider blocking this person and/or reporting abuse
Yes, that's what commit messages are for - for your future self (or someone else) who views the commit history of a file and wonders "why the heck did he/we make this change??"
What works well for me, if/when my work is driven from tickets (Jira, Trello, whatever) is to simply put the ticket number in the commit message ...
If the tickets are granular (not huge catch-all tickets for a whole month of development), and if the tickets contain relevant and detailed info, then just being able to look up the relevant ticket can make all the difference - you'll know the full background and context, which probably tells you WHY you made that change ...
(most of the time my git feature branch would also contain the ticket number, but normally I'd delete those branches after merging them, so adding the ticket number to the commit message just makes sense)
Leob ticket number in the commit message is the simplest, most practical tip Because the ticket has the conversation. The ticket has the context. The ticket has the why The commit message just needs to point to it.
If tickets are granular not huge catch-all tickets for a whole month this is the key Granular tickets useful context. Huge tickets useless context.
I've definitely been on both sides. And you're right the ticket number saves future-you from the why did I do this? moment.
Thanks for the practical addition. ๐
Ran into this with agents writing commit messages for test fixes. First pass was always some variant of update tests with no context on WHY. Required a previous-behavior / new-behavior / why-changed format after that. Revert rate dropped.
Mykola previous-behavior new-behavior why-changed that's the format The AI gave you update tests That's the what The format forces the why what was wrong, what changed, and why it mattered The revert rate drop proves it. When the message actually explains the change, people don't have to guess Less confusion fewer reverts.
This is the difference between AI wrote a message and AI wrote a useful message The format does the work.
Thanks for the practical tip I'm stealing this. ๐
the revert rate is the right signal tbh - not whether the format was followed but whether people stopped having to dig through context later. those are different things.
I was lucky enough to start my projects using AI and I have to say, even though at the beginning I didn't know what a commit was ๐ , I realized over time that it actually always wrote them pretty well (at least for me) and we often use them precisely as a source of past memory together with state files. So I imagine the problem of imprecise commits might come from the AI not having direct knowledge of the code.

This is one of its commits ๐
translated by Claude
Cartone honest line charts โ straight segments (tension 0) this is actually a good commit message It explains the problem (smooth splines inventing values), the fix (straight segments), the context (Dashboard ยง3, /income P&L), the technical detail (Chart.js tension), and even why it matters (radical-transparency site).
The AI wrote this because I'm guessing you gave it the context. The code change, the ticket, the why. When the AI has the context, it can write a message that tells the story My AI wrote Fixed stuff because I didn't give it anything to work with.
Turns out: you get out what you put in. ๐
Thanks for the example this is the other side of the coin. ๐
The reason it writes 'updated stuff' is that the why was never in the diff - the model can only see what changed, not why you changed it, so it paraphrases the patch back at you. A commit that restates the what is just a worse version of the diff. The one worth writing carries the reason the diff can't: what was broken, why this fix and not another. That part still has to come from you, or be written down somewhere the agent can read it.
Adam this is the most precise explanation in the thread. Thank you A commit that restates the what is just a worse version of the diff That's it The diff already shows what changed The commit message is useless if it just repeats that The message needs to carry the why the reason that isn't in the code The model can only see what changed, not why you changed it This is why AI commit messages are hollow by default. The AI isn't being lazy it's being accurate It only knows what the code says, not the context that led to the change.
That part still has to come from you, or be written down somewhere the agent can read it The insight The AI can't infer the why. It needs the why to be explicit If you don't write it in the ticket, in the spec or in the prompt, the AI can't know it.
Thank you for the precision this is the best comment in the thread. ๐
Loved this read! Itโs such a relatable experience. I think the key takeaway here is that AI tools are great assistants, but they still need human context and oversight especially for something as nuanced as commit messages. Thanks for sharing your honest experience!
Urmila human context and oversight that's the line AI can generate It can't know what mattered about the change That's the part that still needs a human who was there.
Thanks for reading and for the kind words. ๐
Hey, this article appears to have been generated with the assistance of ChatGPT or possibly some other AI tool.
We allow our community members to use AI assistance when writing articles as long as they abide by our guidelines. Please review the guidelines and edit your post to add a disclaimer.
Failure to follow these guidelines could result in DEV admin lowering the score of your post, making it less visible to the rest of the community. Or, if upon review we find this post to be particularly harmful, we may decide to unpublish it completely.
We hope you understand and take care to follow our guidelines going forward!
Hi Sloan thanks for the heads up I used AI to help structure the post and organize my thoughts, but the experiences the Fixed stuff commit message, and the voice in the article are my own. I'd estimate about 10% of the writing is AI-assisted I've added a disclosure at the bottom of the post per DEV's guidelines.
I'll be more mindful of this going forward appreciate the reminder Thanks,
I kinda like letting ai write the commit messages automatically, but we also always attach a ticket number to it at the front so if something is unclear you can always just look the ticket up.
But I do kinda like just hitting commit Copy Paste ticket number and message is already pre generated.
Timo copy-paste ticket number message pre-generated that's the efficient workflow Ticket number is the safety net. Even if the AI message is generic, the ticket holds the context. The message just points to it The problem wasn't the AI it was me not giving it anything to work with No ticket number no context no why Just write a commit message.
Your workflow works because the ticket number ensures traceability.
Thanks for sharing the practical take. ๐
For complete mastery of commit management and write the message which describes all changes in the best way, you have to KNOW CONVENTIONAL COMMITS!
AI is here to assist you and help when you don't have an idea. But If you use just use AI and put your brain in halt mode ๐, you never get a good result and learning process won't happen.
In the end, if you don't understand all parts of a commit message, you can't write a good one.
ProfiDE if you put your brain in halt mode, you never get a good result that's the whole point, isn't it?
AI is a tool, not a replacement. It can help when you're stuck, but if you use it to avoid thinking, the learning stops The commit message isn't just about describing the change it's about understanding the change. If you can't explain what you did, did you really understand what you did? If you don't understand all parts of a commit message, you can't write a good one.
Exactly. The message is a mirror of your understanding.
Conventional Commits are great they add structure. But structure without understanding is just scaffolding with no building.
Thanks for the practical addition. ๐
Commit messages are short, always prefer to write them on my own.
Short and to the point. Just like a good commit message. ๐
The gift framing is so right. I always write for that mid-debugging future person who's already frustrated and doesn't need more confusion.
Richard mid-debugging person who doesn't need more confusion exactly That's the audience Someone already frustrated Just wants to know why.
Good commit message small act of kindness.
Thanks. ๐
I sent "code code code" through as a commit message once ๐คฉ
code code code still better than Fixed stuff. ๐
Captured the vibe at least.
Thanks for the laugh. ๐
This is exactly why I read my commit messages before pushing. ๐
AI can write Shakespeare, but somehow turns "fixed button color" into a 3-paragraph corporate announcement. Great read!
Fixed button color 3-paragraph corporate announcement ๐
AI can't decide between soulless Fixed stuff and way too much This commit addresses the UX discrepancy in the primary call-to-action button's chromatic presentation No middle ground.
Great line thanks for the laugh. ๐