79

I know that Subversion (what we're using at work) can be configured to require comments on commits, however I'm not in a position of power to simply turn this on. I know that my reason for commenting my commits is because it is useful, if only as a memory-jogger, to quickly understand the reason behind the commit. However, this doesn't seem to be enough to combat the two responses I always get:

  1. It takes too long and I just want to get my changes into the repo.
  2. It's easy enough to just look at the diffs.

I even show them the value of simply putting in a JIRA issue ID and how it automatically gets tied to the issue, but still no dice with them.

Worst of all, the person who can make the call is in the same camp: doesn't want to bother and is fine with looking at diffs.

I know it's the right thing to do, but how can I make them see the light? Even if I can't convince my fellow devs, how can I convince management that it's the right thing to do for the business?

  • 4
    Do you need to meet any particular standards, for example ISO or CMMI certification? If you do, convincing management becomes significantly easier. Aside from that...good luck. If you can't convince other developers even after showing them the benefits, I'm not sure how you can convince management. – Thomas Owens Sep 20 '11 at 13:41
  • Unfortunately, no acronym standards are in force. – Chris Simmons Sep 20 '11 at 13:44
  • Well there goes that idea, since you can tie commit log messages into a meeting the goals of a few KPAs from CMMI (and I'm assuming various ISO standards as well, although I'm not as familiar with those as I am with CMMI), it would be easy to convince management that they will serve a goal with auditing and force developers to follow them. But without that, it's tough to implement process improvement without support from the developers and other hands-on people. – Thomas Owens Sep 20 '11 at 13:46
  • 11
    @ChrisSimmons: To make them want to want to comment... have you tried hypnotism? Seriously, I don't think they will want to do it unless they either: 1) experience some sort of problem stemming from a lack of comments 2) are able to gain some immediate benefit. – FrustratedWithFormsDesigner Sep 20 '11 at 13:49
  • 1
    @FrustratedWithFormsDesigner: Heh, I left my pocketwatch at home. I agree they need "pain" (in the right direction) or reward. Right now, they feel pain when imposed upon to summon up a quick thought as to why they are making the change they are making ... wrong direction :( – Chris Simmons Sep 20 '11 at 13:52
  • @ChrisSimmons: Maybe if you made a report that automatically extracted the comments from the commits to make meetings go faster since the comments are already there... but that only works if you have defect meetings where those types of reports are useful. – FrustratedWithFormsDesigner Sep 20 '11 at 13:56
  • Actually, @FrustratedWithFormsDesigner, that would work for any status meetings. I should start doing that for my weekly status reports/meetings. Although more recently, I've been working on non-code tasks, where the documents are in SharePoint instead of version control, and I'm not sure how to do that for SharePoint. – Thomas Owens Sep 20 '11 at 14:11
  • 4
    "Takes too long"? I never remember spending more than a minute on any comment to source control. More like 10 seconds. – jsternberg Sep 20 '11 at 14:24
  • 4
    On the "cause them pain" angle, the best way to do this is to hit them with "I can't find your commit that fixed issue X" a few times. (Though even the best way to cause pain won't work as well as a positive incentive.) – David Schwartz Sep 20 '11 at 22:50
  • @DavidSchwartz many people would take that as being very confrontational... "WHY do need to see my commit? What are you accusing me of?" etc... – nickf Sep 21 '11 at 00:53
  • @nick: That's possible, you have to be able to defuse such confrontations with an innocent explanation, ideally a plausible one. (I'm facing a similar issue, for example.) – David Schwartz Sep 21 '11 at 01:00
  • 4
    if you use bug tracking software for issues, adding a comment to a commit can be as simple as #10291. The reference will be immediately apparent, and all the relevant details should already be in the bug tracking system. – zzzzBov Sep 21 '11 at 04:07
  • @zzzBov He's tried that: "I even show them the value of simply putting in a JIRA issue ID and how it automatically gets tied to the issue, but still no dice with them." – Hugo Sep 21 '11 at 05:55
  • using SVN we force a comment to be entered or else you cant commit the code. its simple and works. – Mauro Sep 21 '11 at 08:06
  • How about: Misunderstand him and get him into a trouble? – Kostya Sep 21 '11 at 09:20
  • @jsternberg: My experience is much the same, but that depends a lot on the granularity of the commits. These days, my commit comments are rarely even a single complete sentence because I'm using git and committing every time I complete a minor sub-task, but they used to be a lot longer back when I was using CVS and only committing once a day. Perhaps OP's team is more on the "once a day" end of the spectrum? (In which case the better question might be how to get them committing more frequently...) – Dave Sherohman Sep 21 '11 at 10:44
  • Enforcing a comment on a commit is all very well but unfortunately it's all too easy to type -m" "... – Ben Sep 24 '11 at 10:30

22 Answers22

78

Focus on "Why". Its all very well looking at the diffs and seeing that someone changed the logical flow of a section of code or something like that, but why did they change it? The why is usually in the associated ticket (JIRA for you).

They may wonder why the "Why" is important but in 2 years time when you have caught some bug that is a knock on effect of that change, knowing why it was done is incredibly important for not only fixing your new bug, but making sure you don't cause the old bug to re-emerge.

There is also the auditing reason. Binding commits and ticket id's make it really easy to say ok, we're pushing out Version 2, this fixes defect 23, 25, 26 and 27 but there are no commits against defect 24 so it is still outstanding.

Kevin D
  • 3,426
  • It is likely not about the "why." There are people who get into a rut and refuse to learn. They need motivation, not an ever increasing barrage of explanations. – riwalk Sep 20 '11 at 14:27
  • 1
    In this case, I think answering the why of a check-in is precisely what you're after: giving the developers a good reason (A.K.A. motivation) why they should use (meaningful) check-in comments. – user Sep 20 '11 at 14:39
  • 5
    It's a matter of convincing the person who can make the call. The appropriate response is: "There were seventeen commits yesterday for no apparent reason. Seeing as they do not contribute to any outstanding bugs or issues, they've been rolled back." – Chris Cudmore Sep 20 '11 at 17:26
  • 2
  • 1
    There's the old close code "WAD" - Working As Designed. There's also the joke close code "WAC" - Working As Coded. It's nice to be able to tell the difference. – Wudang Sep 20 '11 at 21:12
33

Make them do the merges and deal with support. Again maybe you are not in a position to to do this, but if you find yourself being the one to troubleshoot a problem from a previous commit politely send it over the fence and say. I can't tell what you did because there are no commit comments, you made these changes you need to figure it out.

Also for merging branches. Not sure if that falls on you or not, but that is one area I found comments useful.

Again, not in your boat, but when I managed a software team I told them if they made good commit comments I would use those in liou of a weekly status report. Got excellent commits after that one and it was easier for me to keep track of what was going on as the manager as well.

Austyn Mahoney
  • 155
  • 1
  • 1
  • 9
Bill Leeper
  • 4,125
  • 16
  • 20
  • 4
    I like the idea of the status report angle. The "person who can make the call" I mentioned would like that for their own status reports so may be a selling point at that level. – Chris Simmons Sep 20 '11 at 13:41
  • 14
    +392,481 for the "good commits will work in lieu of a weekly status report." It is obvious that showing them "why" has not helped and will not help. Creative solutions like that will help them develop good commit messages. – riwalk Sep 20 '11 at 14:26
  • Me too. Back when I had to complete a lot of fine-grained time-sheets I would use the commit time stamps to estimate how much time I spent on each task. – mikerobi Sep 20 '11 at 20:49
  • 1
    "Make them...deal with support." is the winner for me. After having supported a legacy product for a few years, I cannot bring myself to commit code without some kind of comment. – Malachi Sep 20 '11 at 22:34
  • I wonder if I could use this angle to convince my manager to cut back on status meetings (currently at 3 per week for a 5-man dev team). – greyfade Sep 20 '11 at 22:58
  • Sounds like they don't have a problem doing the merges by looking at diffs. – snakehiss Sep 21 '11 at 02:06
26

We need check-in comments for the same reason we need line breaks and spacing in our code. To make things easier to track down, understand read and comprehend.

Sometimes you need to diff compare, but often you do not. Forcing devs to diff compare when all they needed was to read 2-3 sentences is a total waste of time. I wonder why they don't see the value of developer time.

  • 4
  • 365,000 for this. I don't understand why writing a sentence is so "difficult and time consuming" when doing a diff takes LONGER.
  • – Jennifer S Sep 20 '11 at 15:35
  • 2
    I call it "giving a cr*p about your cohorts." You should almost never have to look at diffs, much less as a matter of course (and apparently-current policy). – Eric Sep 21 '11 at 03:52