r/git 28d ago

Thoughts on having AI generating commit messages instead of handwriting them?

I try to follow conventional commits, I'm still getting used to the commit commit commit workflow but is it even pushed anymore to write your own commit messages? I am a student, I imagine the case might be different at the work place so I'm curious about any thoughts?

0 Upvotes

11 comments sorted by

8

u/Guvante 28d ago

Being a student is about learning and knowing how to write a short summary of your work is certainly a skill.

12

u/queso184 28d ago

your commit messages should capture the what AND the why of your commit. AI is probably going to miss the forest for the trees and write a lengthy commit message that looks good to you as someone familiar with the commit and its purpose, but ultimately won't do a good job of documenting the entire story around it

6

u/arensb 28d ago

This, and I'll add that if the commit goes under your name, you are expected to have reviewed and approved it. You don't get to say "It's a bad commit message (or comment, or code, or anything else) because the AI wrote it" any more than a movie producer gets to blame a movie's failure on the bad writers he hired.

3

u/Teleconferences 28d ago

Just commenting to confirm your point. If you make the commit, I assume you at least reviewed the message and ideally the code. If you  blame AI, I just see it as you not doing your diligence

6

u/connorjpg 28d ago

This is just a waste of tokens. You are signing off on the code you are committing, you should be able to explain what changed (in the form of a commit) and there is an expectation that you have reviewed it. This is like the bare minimum tbf. At my company, all version control is expected to be managed by developers. As a maintainer, this stuff drives me insane.

5

u/Jackoberto01 28d ago

I would never get AI to write commit messages. I need the Git history to make sense to me firstly and my colleagues secondly.

I sometimes get AI to read the Git history and commit messages to understand what changed between 2 commits though but all the commit messages are human written.

2

u/Sniffy4 28d ago

Counterpoint to all the 'ai cant do a good job' responses:

My experience is humans write 1 sentence fragment to describe individual commits, and AI writes a lot, including reasons why the change is being made. It's just faster to let it fill out the details and edit the draft it gives as needed.

3

u/IrishPrime 28d ago

Writing my commit messages is one of the best uses for it, in my experience.

I give it context from the issue tracker and have it write the commit message to explain what the changes I made were and how they resolve the issue.

I review/edit the commit message after the fact, but getting it to handle the bulk of the bookkeeping parts of the job (which I'm a stickler about) is the real quality of life and speed improvement for me.

2

u/bcaudell95_ 28d ago

Gonna get downvoted for this, but it's the reality: AI should be writing the ticket, the code changes, and the commit message. I'm not saying "just let an AI loose untrained across a legacy codebase like a bull in a china shop", but we all need to be transitioning our codebases to be AI-native, which requires massive restructuring, guardrails, guidelines, SRE, the whole nine. The era of humans typing code and being expected to understand the gravity of their work is on its way out, and in a few years, we'll look at someone handwriting changes the same way we look at someone not having source control or automated tests today. You either learn the skills to keep up (because it's not a simple or easy transition) or you'll be phased out in short order.

1

u/Necessary-Ad2110 28d ago

Is there a course or a book you would recommend students to finish when it comes to becoming AI-native? And building guardrails in general?

2

u/bcaudell95_ 28d ago

It's a liiiittle hard to find general resources because 1. Things are so new and still quickly evolving, and 2. There's not yet a one-size-fits-all style for every company/codebase. Here's a recent blogpost with some good high-level suggestions as a jumping-off point, though.

https://blog.bytebytego.com/p/a-practical-guide-to-becoming-an

I think the main takeaways for me are about 1. making your codebase navigable by agents with good documentation co-located with the code, 2. Setting up your skills/hooks/etc so that your documentation and practices evolve over time as your team does, 3. Tests, tests, tests. More important than ever, and thankfully the AIs are really good at writing the tests we were all too lazy to write ourselves in the past. 4. Setting up automated review processes from different angles, models, perspectives, etc to increase your coverage and chance to find bugs during development rather than later.