Skip to content

Commit ae8b09c

Browse files
committed
More info on commit messages in contributing guide
Add more info on how to write a good commit messages along with example showing nicely formatted commit message. Rails git history does not look too well when you try to figure out why particular changes were introduced. We can do much better than that and it's never too late to start.
1 parent 7c95be5 commit ae8b09c

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

guides/source/contributing_to_ruby_on_rails.textile

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,39 @@ h4. Commit Your Changes
343343
When you're happy with the code on your computer, you need to commit the changes to git:
344344

345345
<shell>
346-
$ git commit -a -m "Here is a commit message on what I changed in this commit"
346+
$ git commit -a
347347
</shell>
348348

349+
At this point, your editor should be fired up and you can write a message for this commit. Well formatted and descriptive commit messages are extremely helpful for the others, especially when figuring out why given change was made, so please take the time to write it.
350+
351+
Good commit message should be formatted according to the following example:
352+
353+
<plain>
354+
Short summary (ideally 50 characters or less)
355+
356+
More detailed description, if necessary. It should be wrapped to 72
357+
characters. Try to be as descriptive as you can, even if you think that
358+
the commit content is obvious, it may not be obvious to others. You
359+
should add such description also if it's already present in bug tracker,
360+
it should not be necessary to visit a webpage to check the history.
361+
362+
Description can have multiple paragraps and you can use code examples
363+
inside, just indent it with 4 spaces:
364+
365+
class PostsController
366+
def index
367+
respond_with Post.limit(10)
368+
end
369+
end
370+
371+
You can also add bullet points:
372+
373+
- you can use dashes or asterisks
374+
375+
- also, try to indent next line of a point for readability, if it's too
376+
long to fit in 72 characters
377+
</plain>
378+
349379
TIP. Please squash your commits into a single commit when appropriate. This simplifies future cherry picks, and also keeps the git log clean.
350380

351381
h4. Update Master

0 commit comments

Comments
 (0)