Commit message guidelines: Difference between revisions

(→‎Body of the commit message: mention avoiding patterns or abbreviations)
Line 107: Line 107:
=== Wording ===
=== Wording ===


Please write "New function" instead of "Added function" or "Return retval"
{| class="wikitable"
instead of "Changed to return retval".
! bad
 
! good
Never write "Fixed bug" or similar. That doesn't add any specific
|-
information about what was changed.
| style="color:darkred;" | "Added function"
 
| style="color:green;" | "New function"
The commit message should describe what was changed, not why it was changed.
|-
Any explanation for why a change is needed should appear as comments in the
| style="color:darkred;" | "Changed to return retval"
code, particularly if there is something that might not be obvious to someone
| style="color:green;" | "Return retval"
reading it later.
|-
| style="color:darkred;" | "Fixed bug"
| style="color:green;" | Write '''what''' has changed.
|}


The commit message should describe '''what''' was changed, not '''why''' it was changed. Any explanations should appear as comments in the code, particularly if there is something that might not be obvious to someone reading it later.


== Examples ==
== Examples ==