2 ms·
>the number one rule of commit messages in my book is explaining WHY the commit exists The commit message should say what changed, not why. Comments are for e
by davexunit 12y ago
>the number one rule of commit messages in my book is explaining WHY the commit exists
The commit message should say what changed, not why. Comments are for explaining why the code does what it does.
Good commit log: http://git.savannah.gnu.org/cgit/guix.git/commit/?id=fb519bd8313e192d6eca2e51f9f33c87e5ee883e http://git.savannah.gnu.org/cgit/guix.git/commit/?id=fb519bd...
- qznc 12y agoComments tell why the code does what it does. Commit messages tell why the code does something different than before. Example comment: i++; // because server starts counting at 0 (not 1) Example commit: Our customer switched to bar (from foo), which starts counting at 0 instead
- pjc50 12y agoThe diff shows you what changed. The commit message is a comment on the diff and absolutely should say what it's for. This enables you to easily compile release notes, for example.
- davexunit 12y agoYes, it should say what it's for, but it shouldn't need to explain itself any further. Sorry if I didn't make that clear. For example, if someone refactored something, the commit log can simply say "Factorize foo", it need not explain why they were refactoring in the first place.
- nirvdrum 12y agoThat works as long as you're adding code. But what about when you're deleting code? I absolutely want to know why you've removed something.