Writing good commit messages

Source: Internet
Author: User

The author of pro git
(An excellent online book) gives this advice for commit messages:



Getting in the habit of creating quality commit messages makes using
And collaborating with git a lot easier. As a general rule, your
Messages shoshould start with a single line that's no more than about 50
Characters and that describes the Changeset concisely, followed by
Blank line, followed by a more detailed explanation. The GIT Project
Requires that the more detailed explanation include your motivation
The Change and contrast its implementation with previous behavior-
This is a good guideline to follow. It's also a good idea to use
Imperative present tense in these messages. In other words, use
Commands. Instead of "I added tests for" or "adding tests for," Use
"Add tests for." Here is a template originally written by Tim Pope
Tpope.net:



Short (50 chars or less) Summary of changes

 

More detailed explanatory text, if necessary. Wrap it to about 72 characters or so. In some contexts, the first line is treated as
Subject of an email and the rest of the text as the body. The blank line separating the summary from the body is critical (unless you
Omit the body entirely); tools like rebase can get confused if you run the two together.

Further paragraphs come after blank lines.

-Bullet points are okay, too
-Typically a hyphen or Asterisk is used for the bullet, preceded by a single space, with blank lines in between, but conventions vary here

If all your commit messages look like this, things will be a lot easier for you and the developers you work. the GIT project has well-formatted commit messages-I encourage you to run git log -- no-merges there to see what a nicely formatted project-commit history looks like.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.