- Separate subject from body with a blank line.
- Limit the subject line to 50 characters.
- Capitalize the subject line.
- Do not end the subject line with a period.
- Use the imperative mood in the subject line. (Start the line with "Fix", "Add", "Change" instead of "Fixed", "Added", "Changed".
- Wrap the body at 72 characters.
- Use the body to explain what and why vs. how.
How to Write a Git Commit Message - Chris Beams chris.beams.io/posts/git-commit/
Good commit messages serve at least three important purposes:
- To speed up the reviewing process.
- To help us write a good release note.
- To help the future maintainers...
-
Why is this change necessary? This question tells reviewers of your pull request what to expect in the commit, allowing them to more easily identify and point out unrelated changes.
-
How does it address the issue? Describe, at a high level, what was done to affect change. Introduce a red/black tree to increase search speed or Remove , which was causing are good examples. If your change is obvious, you may be able to omit addressing this question.
-
What side effects does this change have? This is the most important question to answer, as it can point out problems where you are making too many changes in one commit or branch. One or two bullet points for related changes may be okay, but five or six are likely indicators of a commit that is doing too many things.
Consider making including a link to the issue/story/card in the commit message a standard for your project. Full urls are more useful than issue numbers, as they are more permanent and avoid confusion over which issue tracker it references.
To take advantage of this sweet integration, first you’ll need to configure Git to use your editor (specifically, your editor’s command-line program, if it has one). Here, I’m telling Git to hand off commit messages to Atom:
$: git config --global core.editor "atom --wait"