Difference between revisions of "Commit Guidelines"

From ScummVM :: Wiki
Jump to navigation Jump to search
m
(Removed some unnecessary explanations, some cleanup)
Line 2: Line 2:


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:
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 ==
== 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.
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 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.
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 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 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.
 
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 ==
== Examples ==
I'll give some examples. Please understand that I do not mean this personal, so if you see yours listed here -- I don't want this to tarnish your reputation, I think none of us is "free of sin" here :-). I included messages from me, too.
Commit messages like the following aren't very helpful:
 
 
Examples: 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?
Line 38: Line 32:
* "Add patch #1374870 - New Lure of the Temptress module"
* "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 (hi Erik, I do enjoy your commit messages greatly, don't get me wrong :-).
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.

Revision as of 12:17, 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?

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.