Difference between revisions of "Commit Guidelines"

From ScummVM :: Wiki
Jump to navigation Jump to search
m (Commit-Guidelines moved to Commit Guidelines)
(Added note about empty commit messages)
Line 16: Line 16:
== Examples ==
== Examples ==
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?
* "bye bye" --> was some obsolete code removed? Or did somebody leave the project? Or what?
* "bye bye" -> was some obsolete code removed? Or did somebody leave the project? Or what?
* "Reverse to match values" -> Reverse which values to match what?
* "Reverse to match values" -> Reverse which values to match what?
* "Move to supported games" -> move what?
* "Move to supported games" -> move what?
Line 23: Line 23:
* "One more file to fix"  
* "One more file to fix"  
* "This difference only applies to SCUMM7+" -> which difference?
* "This difference only applies to SCUMM7+" -> which difference?
* "" -> empty commit messages are about the worst you can do :-/ (short of insults and totally offtopic messages).


Always keep in mind -- those message are often read *without* seeing the diffs, and without the possibility to see which other files you commited just before that particular commit!
Always keep in mind -- those message are often read *without* seeing the diffs, and without the possibility to see which other files you commited just before that particular commit!

Revision as of 13:28, 12 February 2006

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 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.


Examples

Commit messages like the following aren't very helpful:

  • "not needed" -> uhm, what is not needed?
  • "bye bye" -> was some obsolete code removed? Or did somebody leave the project? Or what?
  • "Reverse to match values" -> Reverse which values to match what?
  • "Move to supported games" -> move what?
  • "Forgot *.xpm files" -> forgot what about them?
  • "One more file to fix"
  • "This difference only applies to SCUMM7+" -> which difference?
  • "" -> empty commit messages are about the worst you can do :-/ (short of insults and totally offtopic messages).

Always keep in mind -- those message are often read *without* seeing the diffs, and without the possibility to see which other files you commited just before that particular commit!

Compare this to

  • "Change CVS keywords to SVN keywords"
  • "Move Pajama3 to supported games"
  • "Added compression tool for kyra speech files."
  • "Add patch #1374870 - New Lure of the Temptress module"

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.