12 ms·
Doesn't mean others are in the same boat as you. The team I work on frequently write detailed commits to the point where I can (and have several times) successf
by fraudsyndrome 4y ago
Doesn't mean others are in the same boat as you. The team I work on frequently write detailed commits to the point where I can (and have several times) successfully searched information from years ago on a block of code with the ticket number and the developers (even myself) reasoning at the time.
Maybe it depends on the project but I've found myself doing this so often that I won't stop, it's such a small task that has given me so much benefit. If it doesn't help anyone then nothing was lost.
- ArrayBoundCheck 4y agoWhy are you searching a year or more back? Is this using git blame?
- shakna 4y agoTo explain why a certain block of code exists. When the code came into existence is rarely that important. You just want to know why. Why does the code fence against a particular circumstance you didn't think should be possible? Why does it call out to something you think is unrelated? Those questions can be answered by a proper commit message.
- kazinator 4y agoSometimes, in some kinds of projects, the commit messages looks like this: JIRA: #1234 Adjusted the FOOBAR parameter from 42 to 73. To know the "why", you have to read the ticket; you will not find anything in the git log.
- erik_seaberg 4y agoOh jeez, please do not make me run “git log” and then open a hundred tabs in an old bug tracker that may or may not still exist to figure out when a problem may have been introduced. I want code reviewers to insist on at least somewhat useful messages for us to skim at 3 AM.
- ArrayBoundCheck 4y agoI set a breakpoint and run the test suite for that answer
- fragmede 4y agoThat answers what the code does, but not why it does what it does.
- tuwtuwtuwtuw 4y agoSo you never need to understand when or why a bug was introduced? Or you never need to understand why the current behavior as is it is?
- ArrayBoundCheck 4y ago
- ArrayBoundCheck 4y ago
- dang 4y agoCould you please stop breaking the site guidelines? You've been doing it a lot lately, unfortunately. Not just with these off-topic complaints about downvoting, but with comments like these: https://news.ycombinator.com/item?id=32104697 https://news.ycombinator.com/item?id=32104697 https://news.ycombinator.com/item?id=32086054 https://news.ycombinator.com/item?id=32086054 https://news.ycombinator.com/item?id=32085905 https://news.ycombinator.com/item?id=32085905 https://news.ycombinator.com/item?id=32085736 https://news.ycombinator.com/item?id=32085736 We eventually ban accounts that carry on like this on HN. I don't want to ban you, so if you'd please review https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html and stick to the rules when posting here, we'd appreciate it.
- ArrayBoundCheck 4y ago
- d3nj4l 4y agoWhy don’t you put that as a comment on the code?
- kazinator 4y agoBecause if 37 changes are done to the same 15 line function over time, the amount of comment material will dwarf the function. And most of it will pertain to historic versions of the function which are not what actually appears below the comment; a comment made 13 revisions ago makes sense for the 13-revision-old version of the function.
- d3nj4l 4y agoYou just update the comment?
- lexicality 4y agoComments are for why code is written the way it is, commits are for why the code is written in the first place. You _could_ tag every line of code with // JIRA-123 The PM wants this to be blue but if you did it would become unreadable and wouldn't be kept up to date.