this post was submitted on 10 Oct 2024
1 points (53.8% liked)

JetBrains

172 readers
1 users here now

A community for discussion and news relating to JetBrains and its products! https://www.jetbrains.com/

Related Communities

Copyright ยฉ 2000-2024 JetBrains s.r.o. JetBrains and the JetBrains logo are registered trademarks of JetBrains s.r.o.

founded 10 months ago
MODERATORS
 

After seeing people use the @jetbrains UI to commit to git I understand where all those - sorry: shitty - commit messages come from....

๐Ÿ™ˆ

An improvement would already be to have a "Subject" line and the text box.

And have the subject line follow the Beams Rule.

Sonthat the first line of the commit message finishes the sentence

"When this commit is applied it will..."

And please: No longer than 56(?) characters (Unicode). Keep it short. You got the textbox to explain *why* in full length.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] BatmanAoD 0 points 1 month ago (17 children)

The gitlog is intended for contributors of the project whereas the chamgelog is intended for users of the project.

That makes sense to me.

I think I would still argue, however, that for projects using github, gitlab, or any similar forge with a built-in pull-request + code-review feature, there's very limited value in spending time crafting good commit messages in a feature branch. All information that you may be tempted to put there would be more visible and more useful either as code comments (which applies to all projects, not just GH) or as comments in the PR description or discussion. (I also think it's often better to just squash feature branches on merge than to try to maintain a clean branch history while the feature is in development.)

I do think that the commit messages that actually end up on your trunk are important; but, with the exception of the final PR merge (or squash) commit, developers should minimize the time spent writing or thinking about these commit messages.

The one context in which I find details in historical commit messages potentially useful is when using git log -p to figure out when and why something changed. But even then, once I've found the relevant commit, looking up the PR to see if there was any discussion about the change in question is generally the next step; so again, having substantial detail in the commit message itself is unlikely to be helpful.

[โ€“] [email protected] 0 points 1 month ago (7 children)

@BatmanAoD Having done code archeology for over a decade now I can assure you that the issue with all the information that you need to understand why something was done has been discarded just shortly before due to moving to a different platform... Or something similar.

In any case: Having all the relevant data in one place and not scattered is a huge advantage.

[โ€“] [email protected] 2 points 1 month ago (6 children)

@BatmanAoD And every developer should take the time to create a meaningful commit-message for the work they did. After all they invested a good amount of time into the code change, so why not proudly explain why they did it, what the challenges where and why they did it
*that* way?

But on the other hand: It's documentation, so just drop it ๐Ÿ™ˆ

Also: Code-comments are fine but tend to rot during code changes. The commit message is always tied to the commit.

[โ€“] BatmanAoD 0 points 1 month ago* (last edited 1 month ago) (2 children)

It's not documentation, though. That's my point. It's a byproduct of the development cycle, not a place to store important information.

Commit messages are tied to a commit, sure, but why do you expect developers to have better discipline in writing commit messages than they have in updating code comments?

[โ€“] [email protected] 1 points 1 month ago

@BatmanAoD Because the commit message is a requirement when committing code. The code comment is sitting there and no one cares whether it'S updated.

And a certain schema of a commit message can be enforced. Git hooks for example can be used to make sure that the commit message looks a certain way, has a minimum length, is formatted according to declared standards. As one would do for code-style.

Then they still can just add garbage. But then you have a people problem that no tech will solve

[โ€“] [email protected] 0 points 1 month ago (1 children)

@BatmanAoD Because the commit message is a requirement when committing code. The code comment is sitting there and no one cares whether it'S updated.

And a certain schema of a commit message can be enforced. Git hooks for example can be used to make sure that the commit message looks a certain way, has a minimum length, is formatted according to declared standards. As one would do for code-style.

Then they still can just add garbage. But then you have a people problem that no tech will solve

[โ€“] [email protected] 2 points 1 month ago (1 children)

@BatmanAoD And the commit message *is* documentation. It explains the "Why" making transparent why the code was written the way it is. If the commit message doesn'T reflect that, then you can also use git commit -m "Fixed issues"

But again: That is then a people problem that no tech will solve!

[โ€“] BatmanAoD 2 points 1 month ago (1 children)

My point is that "the comments aren't accurate" is also a people problem. And I absolutely disagree that commit messages are "documentation" of anything except the development history.

[โ€“] [email protected] 1 points 1 month ago

@BatmanAoD Oh I am absolutely with you that commit messages document the development history.

And there are valid cases for code-comments (I am a strong proponent of them) when they explain why something is solved in this specific way that would otherwise cause confusion when reading the code! But those tend to suffer from entropy ๐Ÿ˜

load more comments (3 replies)
load more comments (3 replies)
load more comments (12 replies)