TrustedUser
2,147
edits
(Added note about empty commit messages) |
(Update commit guidelines as per Eugene's email on -devel) |
||
Line 1: | Line 1: | ||
In the past, we were quite lax about commit messages. Well, we won't start beating people up, but I think we should at least all be aware of the issue at hand; namely, what distinguishes good commit messages from bad ones. I hope that this page will help us all to improve our commit messages a bit... | In the past, we were quite lax about commit messages. Well, we won't start beating people up, but I think we should at least all be aware of the issue at hand; namely, what distinguishes good commit messages from bad ones. I hope that this page will help us all to improve our commit messages a bit... The benefit will be to the full team as commit logs will be more readable. | ||
== Rules == | |||
Thus the rules are following (they're standard to git except SUBSYSTEM thing): | |||
<pre> | |||
SUBSYSTEM: Short (50 chars or less) summary of changes | |||
More detailed explanatory text, if necessary. Wrap it to about 72 | |||
characters or so. In some contexts, the first line is treated as the | |||
subject of an email and the rest of the text as the body. The blank | |||
line separating the summary from the body is critical (unless you omit | |||
the body entirely); tools like rebase can get confused if you run the | |||
two together. | |||
Write your commit message in the present tense: "Fix bug" and not "Fixed | |||
bug." This convention matches up with commit messages generated by | |||
commands like git merge and git revert. | |||
Further paragraphs come after blank lines. | |||
- Bullet points are okay, too | |||
- Typically a hyphen or asterisk is used for the bullet, preceded by a | |||
single space, with blank lines in between, but conventions vary here | |||
- Use a hanging indent | |||
</pre> | |||
Particularly the critical is the first line. You may noticed that several developers already started to use this scheme, particularly take a look at Max's or Eugene's commits. This first line is used in short log format, and providing engine name, sound subsystem, backend name or whatever lets decide quickly should reviewers look deeply into commit or skip. | |||
* | The subsystem names which were used so far: | ||
* | * '''AGOS''', '''SCI''', '''SCUMM''', whatever engine name | ||
* | * '''SDL''', '''Android''', '''WII''', '''NDS''', whatever backend name | ||
* | * '''OSystem''': our middleware code | ||
* | * '''i18n''': internationalization | ||
* '''GUI''': all gui-related | |||
* '''TOOLS''': ScummVM tools module or built-in tools | |||
* '''MIDI''': MIDI sound-related | |||
After first line there has to be an empty line which is used as separator, and also this first line has to be short, less than 50 characters, so log will fit on standard 80 columns terminal. | |||
== | == Good Practice == | ||
Commit messages like the following aren't very helpful: | Commit messages like the following aren't very helpful: | ||
* "not needed" -> uhm, what is not needed? | * "not needed" -> uhm, what is not needed? | ||
Line 34: | Line 60: | ||
Don't be too verbose in your message either. You don't have to tell people what the next step in the grand scheme are in a long paragraph. | Don't be too verbose in your message either. You don't have to tell people what the next step in the grand scheme are in a long paragraph. | ||
== More to read == | |||
http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html | |||
http://kernel.org/pub/software/scm/git/docs/user-manual.html#creating-good-commit-messages | |||
The following is an excerpt from the FreeBSD Committer's Guide <http://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/article.html> and sums up quite nicely what I think: | |||
=== Excerpt from the FreeBSD Committer's Guide === | |||
Good commit messages are important. They tell others why you did the changes you did, not just right here and now, but months or years from now when someone wonders why some seemingly illogical or inefficient piece of code snuck into your source file. It is also an invaluable aid to deciding which changes to MFC and which not to MFC. | |||
* Commit messages should be clear, concise and provide a reasonable summary to give an indication of what was changed and why. | |||
* Commit messages should provide enough information to enable a third party to decide if the change is relevant to them and if they need to read the change itself. | |||
* Avoid committing several unrelated changes in one go. It makes merging difficult, and also makes it harder to determine which change is the culprit if a bug crops up. | |||
* Avoid committing style or whitespace fixes and functionality fixes in one go. It makes merging difficult, and also makes it harder to understand just what functional changes were made. In the case of documentation files, it can make the job of the translation teams more complicated, as it becomes difficult for them to determine exactly what content changes need to be translated. | |||
* Avoid committing changes to multiple files in one go with a generic, vague message. Instead, commit each file (or small, related groups of files) with tailored commit messages. |