You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: guides/source/contributing_to_ruby_on_rails.textile
+31-1Lines changed: 31 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -343,9 +343,39 @@ h4. Commit Your Changes
343
343
When you're happy with the code on your computer, you need to commit the changes to git:
344
344
345
345
<shell>
346
-
$ git commit -a -m "Here is a commit message on what I changed in this commit"
346
+
$ git commit -a
347
347
</shell>
348
348
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
+
349
379
TIP. Please squash your commits into a single commit when appropriate. This simplifies future cherry picks, and also keeps the git log clean.
0 commit comments