Skip to content

Commit 64e12ff

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 b0f8355 commit 64e12ff

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

railties/guides/source/contributing_to_ruby_on_rails.textile

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,41 @@ h4. Commit Your Changes
329329
When you're happy with the code on your computer, you need to commit the changes to git:
330330

331331
<shell>
332-
$ git commit -a -m "Here is a commit message on what I changed in this commit"
332+
$ git commit -a
333333
</shell>
334334

335+
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.
336+
337+
Good commit message should be formatted according to the following example:
338+
339+
<plain>
340+
Short summary (ideally 50 characters or less)
341+
342+
More detailed description, if necessary. It should be wrapped to 72
343+
characters. Try to be as descriptive as you can, even if you think that
344+
the commit content is obvious, it may not be obvious to others. You
345+
should add such description also if it's already present in bug tracker,
346+
it should not be necessary to visit a webpage to check the history.
347+
348+
Description can have multiple paragraps and you can use code examples
349+
inside, just indent it with 4 spaces:
350+
351+
class PostsController
352+
def index
353+
respond_with Post.limit(10)
354+
end
355+
end
356+
357+
You can also add bullet points:
358+
359+
- you can use dashes or asterisks
360+
361+
- also, try to indent next line of a point for readability, if it's too
362+
long to fit in 72 characters
363+
</plain>
364+
365+
TIP. Please squash your commits into a single commit when appropriate. This simplifies future cherry picks, and also keeps the git log clean.
366+
335367
h4. Update master
336368

337369
It’s pretty likely that other changes to master have happened while you were working. Go get them:

0 commit comments

Comments
 (0)