by rco8786 · 2y ago · 0 comments
And also the discourse around commit messages and their various flavors may be one of the biggest wastes of time in terms of ROI in our industry.
I’ve been doing this for 14-15 years and can probably count on two hands the number of times I’ve needed to look at historical commit messages.
I see it as a matter of scoping communications. The issue management system includes a broader set of people than the git repo. You want the commit linked to the issue so that you can see the entire history behind the commit, including the business decisions, the designer making a call, the back and forth with QA etc. That can all be useful a year or two down the road if you want to understand why something was done a certain way.
Now there is some info about the change that perhaps only the devs would ever care about, and probably that can sit in the commit messages. That sort of happens naturally but there's not really a lot of it for us. But that seems to me to be the relevant thing from an organizational perspective, no one writes commit messages except for devs, and almost nobody except the devs reads them.
I think that breaks the thing that people want which is being able to `git commit -m "Fix #234353"` without a body at all.
Having said that, I care very little about style and grammar of commit messages. Ideally I want them to say why the change was made, what the intended effect was, and where I can look for related work (bugs that tracked the work and have related commits or investigation attached to them, docs, whatever)
Hit rate on the information I'd like is not great, but if I get at least one of the three things then it's something I can work with.
Commit messages have only ever been useful in tracking my own intermediate work products. Often times, I will leave helpful bread crumbs in my commit notes if I know I won't be working on something for a few days. We strictly do squash+merge, so I don't have to worry about these things causing trouble for others. All of our commits into master have some standardized "Issue #1234" note as automatically copied from the PR title (which we do have ~standardized).
If we didnt have some git wrapper like GitHub available, then I suspect we'd be significantly more aggressive with policy around our commit messages.
I wonder what is so different about our workflows, that some people do it all the time and others almost never.
Are we working on somehow very different things.
To me I find that code is the source of truth and current state, it doesn't really matter to me as much why or how something came to be as I look more into how I can make the current thing work with what I am to do.
Or simply the projects you work with have poor commit messages?
I would say however that the commit messages mostly are just squashed pull requests with ticket names and single sentence so I'd agree that they wouldn't be very good for that purpose, but I don't see anyone at the org complaining about this.
It's mostly on the Internet I read how others use the git history, but I haven't seen anyone really doing a lot of that in real life.
What I normally do is, while investigating a tricky bug and finding some lines that don't make sense, look through history to see why those lines were introduced (to see if they fix something else), and perhaps when (to see which versions may be affected by a hard-to-reproduce bug). But that typically pinpoint a commit already, and I just need the commit message to explain why it was there.
That said, there's probably some fringe benefit to describing what you do in some fashion. It's a great way of making sure you understand what's happening yourself.
It’s not like you need the history (is this a refactor or something else? doesn’t matter) so you don’t need to keep around such failed attempts.
Which is a very interesting take, for what it's worth. Might be worth a blog post what circumstances lead to this working well for your organization!