Re:What a good commit message looks like (2011)
by mojuba on Thursday January 26, 2017 @11:13AM
(#13492533)
Should be noted, it is often tempting to describe everything about the change in the commit description rather than comments in the code. Remember, git commits disappear from sight pretty soon and become fossils, whereas there may be something important that should be said in the code itself.
[ Parent
| on HN ]
Re:What a good commit message looks like (2011)
by karim on Thursday January 26, 2017 @11:17AM
(#13492577)
I think that on the contrary, everything should be in the commit. The commit message is dated, it has an author and a context. How often do you come across stray comments which shouldn't be here because the code got refactored away? Commis are often just a git blame away anyway.
Re:What a good commit message looks like (2011)
by Cthulhu_ on Thursday January 26, 2017 @11:37AM
(#13492780)
Except when a line has been changed over a longer period of time. Although maybe I'm just not comfortable with tracking history too much, because in the applications I generally work on (customer-facing webapps) we generally don't need to look back in history too much.
Re:What a good commit message looks like (2011)
by nailer on Thursday January 26, 2017 @11:17AM
(#13492586)
Also: avoid using comments where proper names would suffice:
// cleans responses
function zrgfy(response){
...
}
should be something like: function cleanResponse(response){
...
}
Re:What a good commit message looks like (2011)
by chousuke on Thursday January 26, 2017 @11:26AM
(#13492680)
My rule of thumb in commenting is that I comment the why or how, not the what... Unless the what is sufficiently non-obvious, in which case it is usually prudent to have a really good explanation of the why, as well.
Re:What a good commit message looks like (2011)
by lysis on Thursday January 26, 2017 @11:28AM
(#13492692)
A commit doesn't suffer from the same bit rot as a comment. Descriptions of how code changes doesn't shift as much as description of how code operates. If git blame, git log, and git diff are part of your workflow finding a git commit describing a piece of code is easy.
Re:What a good commit message looks like (2011)
by makecheck on Thursday January 26, 2017 @01:43PM
(#13494007)
The commit message is frequently the only comment that ties the set of changes together so it is a good place to describe the change as a whole. This is not always clear when looking at any particular function, for example.
Re:What a good commit message looks like (2011)
by nevon on Thursday January 26, 2017 @11:19AM
(#13492606)
Highly disagree. As long as the code lives, the commit lives.
Re:What a good commit message looks like (2011)
by jbattle on Thursday January 26, 2017 @11:23AM
(#13492657)
until the git killer comes along and the team decides how much history they are willing to migrate. I've seen it happen every 5(?) years across several companies. Ironically it's always the oldest commit messages that turn out to be the most valuable because newer changes people remember
Re:What a good commit message looks like (2011)
by k__ on Thursday January 26, 2017 @11:28AM
(#13492693)
What is "The Git Killer"?
Re:What a good commit message looks like (2011)
by telotortium on Thursday January 26, 2017 @11:47AM
(#13492878)
That's just a generic stand-in for any new version control system that becomes popular enough to display Git. For example, Pijul (https://pijul.org), although Pijul specifically won't become popular because it's licensed under AGPL3.
Re:What a good commit message looks like (2011)
by jbattle on Thursday January 26, 2017 @12:30PM
(#13493299)
yep as telo.. said - whatever will inevitably supercede git. In my own work it was VSS > Perforce > svn > git
All of those were good choices when they were new, and suboptimal choices when the next better solution came along.
Re:What a good commit message looks like (2011)
by k__ on Thursday January 26, 2017 @12:37PM
(#13493356)
I had the feeling companies would just stick to their thing.
Last I worked with used CVS and always talked about switching to SVN, but never did.