-
Notifications
You must be signed in to change notification settings - Fork 180
Git Commit Message Guidelines
Aaron Hoffer edited this page Feb 14, 2019
·
3 revisions
- Begin the subject line with the name of the project, "DDF", followed by a dash, followed by the issue number
- If the issue was created in JIRA, use the four digits of the issue number. For example, "DDF-1212"
- If the issue was created in GitHub, prefix the four digits of the issue number with a zero. For example "DDF-01212"
- Separate subject from the body with a blank line
- Limit the subject line to 50 characters
- Capitalize the first word of the subject line
- Do not end the subject line with a period
- Use the imperative in the subject line
- Wrap the body at 72 characters
- Use the body to explain what and why vs. how. In particular, try to give some idea of the expected behavior this commit adds.
DDF-1234 Write a (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 the 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
- Short, meaningful titles, followed by a blank line is used throughout git, GitHub, and other tools. Following this convention produces more readable output from logging tools and it makes things like annotating or blaming more readable. It also forces the developer to think critically and communicate clearly about the work done in each commit.
- Good titles save the teams from extra reading and research into the purpose of a commit. A title should answer the question of "When this commit is applied, it will...". A commit does something. It is an action performed on the codebase, and the title should reflect the imperative nature of commits.
- Ensures the body of a commit communicates the information other developers need. The how is in the diff, the commit message needs to explain what and why.