Commit message guidelines: Difference between revisions

→‎One-line description: reword for clarity, add build prefix
(add more examples and explanation from the manual)
(→‎One-line description: reword for clarity, add build prefix)
Line 24: Line 24:
=== One-line description ===  
=== One-line description ===  


The commit message should have a brief a one-line description of what the
The commit message should start with a brief one-line description of what the
commit does. Keep it short, preferably under 80 characters. If you are
commit does. Keep it short, no longer than 80 characters. If you are working
patching a bug, this one-line explanation should mention the bug number
on a bug or applying a patch, this one-line explanation should mention the bug
at the end like so: {{codeline|... (bug #12345)}}. Omit final period (full stop).
or patch number at the end like so: {{codeline|... (bug #12345)}}. Do not end
the first line with a period (full stop).


If your change only touches one file, then the filename of that file should
If your change only touches one file, then the name of that file can be the
be the prefix of the one-line description. If it's a C++ or C file, the
prefix of the one-line description. If it's a C++ or C file, the function or
function or class that is being modified should be included in the
class that is being modified should be included in the parenthetical remark,
parenthetical remark, as in the full body of the commit message.
as in the full body of the commit message.


In addition, there are two prefixes for special commits:
In addition, there are a few prefixes for certain types of commits:


* maint: for reorganisation of the sources that do not change the source. Regular merge commits are a prominent example.
* maint: for reorganisation of the sources that do not change the source. Regular merge commits are a prominent example.
* doc: for changes to the documentation.
* doc: for changes to the documentation.
* build: for changes to the build system, for example autoconf or automake files.


If your change is small and only touches one file then this is
If your change is small and only touches one file, then the one-line
typically sufficient.
description may serve as the entire commit message.


=== Body of the commit message ===
=== Body of the commit message ===
296

edits