Skip to content

Instantly share code, notes, and snippets.

@GregoryArmstrong
Created January 7, 2016 16:52
Show Gist options
  • Save GregoryArmstrong/45be918fb5318d93ffdd to your computer and use it in GitHub Desktop.
Save GregoryArmstrong/45be918fb5318d93ffdd to your computer and use it in GitHub Desktop.
Proper Commit Messages

Teams should agree on commit message conventions:

  • Style: How does the team want to handle markup syntax, wrapping margins, grammar, capitalization and punctuation. This aids in consistency.
  • Content: What should your commit message contain or not contain?
  • Metadata: Do you want to have Tracking IDs, pull requests numbers, perhaps milestone references or waffle.io issue references?

http://chris.beams.io/posts/git-commit/ 's 7 rules of a great commit message:

  1. Separate subject from body with a blank line
  2. Limit the subject line to 50 or less characters
  3. Capitalize the subject line
  4. Dont end the subject line with a period
  5. Use the imperative mood in the subject line 5.1 A properly formed git commit subject line should always be able to complete the following sentence: "If applied, this commit will #{your subject line here}"
  6. Wrap the body at 72 characters
  7. Use the body to explain what and why vs. how

This site also says it may be better to use something other than the -m "message" addition to the command line, so that you can add stylistic elements suh as a body or paragraphs to the commit. This could be done with an editor instead.

https://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message 's 5 rules:

  1. 50 character or less subject line
  2. Add this line: autocmd Filetype gitcommit setlocal spell textwidth=72 To your ~/.vimrc to add spell checking and automatic wrapping (I think this would only apply to the Vim editor, not sure)
  3. Never use -m on a git commit command line entry.
  4. Answer the questions:
  5. Why is this change necessary?
  6. How does it address the issue?
  7. What side effects does this change have?
  8. Link to issue/story/cards in your commit message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment