Live data from Hacker News

Linus: please write good git commit messages

github.com

21–30 of 58 posts

Re: Linus: please write good git commit messages

#21

Not to sound like I'm boasting, but most of my commits are far too atomic to warrant more than a first line. If I need to write several paragraphs about the changes I'm making, it's definitely too large a commit.

No one is saying to write a lot. The point is to write enough. You should basically be able to hand someone the commit log and they should be able to easily figure out how the current state of the code came into being without having to dig into the code.

Small commits are fine and often don't warrant several lines. I've done that too.

It's often a fine line between a commit that's too big and too small. At the same time, just because a commit warrants a few sentences about it that doesn't necessarily mean it was too large. I don't want to keep being long winded here so I won't go into examples as I think we've all seen situations like what I'm talking about but I'd be happy to add an example later if necessary.

Re: Linus: please write good git commit messages

#22
post #6

Earlier quoted context omitted.

I agree. I was looking for the irony in that message where Linus didn't follow his own style guidelines...

Isn't the head guy pretty much allowed to ignore style guidelines in his own project? I'm not saying that's a good thing, mind you.

I don't think anyone is allowed to ignore guidelines. When you know the rules well, you are allowed to bend and break them when it makes sense. But people as a group are often not thoughtful so we have to apply rules to everyone even though a few individuals don't need rules applied to the, because they know what they're doing and generally don't cause trouble.

If we leave it up the masses to be on the honor system then the problem would be much larger. Everyone thinks they're awesome enough to bend the rules when they aren't. It always seems like the people who suck the most are the ones who believe they're the most skilled too. Why is that?

Re: Linus: please write good git commit messages

#23

I'm curious about this: please do proper word-wrap and keep columns shorter than about 74 characters or so How come word-wrapping is left as a task for humans here? Is there a technical/stylistic/cultural reason why lines can't be wrapped automatically to any desired width by the log presentation layer?

Doesn't mean humans have to do it. When using vim for git commit messages it wraps them to 74 characters for me.

Re: Linus: please write good git commit messages

#24
post #3

It's hard to understate the importance of this. GitHub's online editor has a default commit message along the lines of "Edited path/to/file", and I see a lot of pull requests with that message, and nothing else. That's about the most useless message possible, since it adds no information that isn't already implicit in the commit. It would be better to leave it blank and force users to at least write _something_.

Be careful, we do that by default and we get a lot of "commit", "commit", "commit $date", "merge commit" messages from some programmers. Either a programmer accepts that a meaningful message is important on commits, or they don't. It's a people problem not a technical one.

The problem with that is that at least when I am merging something I often (with Mercurial anyway) don't have anything useful to say -- the commit is even marked specially as a merge commit. Other than bringing in one branch (which has hopefully been correctly commented) no changes were made.

So really, what do you want them to say?

Re: Linus: please write good git commit messages

#26
post #4
post #3

Earlier quoted context omitted.

Be careful, we do that by default and we get a lot of "commit", "commit", "commit $date", "merge commit" messages from some programmers. Either a programmer accepts that a meaningful message is important on commits, or they don't. It's a people problem not a technical one.

Ah, but what if we encouraged programmers to write better commit messages? What if we splashed on a bit of gamification to raise everyone's level of awareness? Maybe a badge on your profile page...?

Any you will determine that, programmatically, how exactly?

Besides, badges are for kids.

Re: Linus: please write good git commit messages

#28
post #10

Basically, your git log should read like a blog about your project.

Eh, yes and no. It should give context and detail but only the necessary details. The kind someone would need to get their bearings if you threw the code at them with no point of reference besides the log.

Re: Linus: please write good git commit messages

#29

Earlier quoted context omitted.

Isn't the head guy pretty much allowed to ignore style guidelines in his own project? I'm not saying that's a good thing, mind you.

I don't think anyone is allowed to ignore guidelines. When you know the rules well, you are allowed to bend and break them when it makes sense. But people as a group are often not thoughtful so we have to apply rules to everyone even though a few individuals don't need rules applied to the, because they know what they're doing and generally don't cause trouble. If we leave it up the masses to be on the honor system t…

Guidelines, by definition, only exist to guide people.

So yes, you are allowed to wander past them, ignore them, and use them as you believe most efficient.

Re: Linus: please write good git commit messages

#30

I'm curious about this: please do proper word-wrap and keep columns shorter than about 74 characters or so How come word-wrapping is left as a task for humans here? Is there a technical/stylistic/cultural reason why lines can't be wrapped automatically to any desired width by the log presentation layer?

I hate to ask an off-topic question here, but is it considered good/bad practice to word-wrap plain text emails?
Post reply on HN