Skip to content

Instantly share code, notes, and snippets.

@fijimunkii
Forked from sukima/BetterCommitMessages.md
Last active August 29, 2015 14:23
Show Gist options
  • Save fijimunkii/b5abfacb8e00cec669bd to your computer and use it in GitHub Desktop.
Save fijimunkii/b5abfacb8e00cec669bd to your computer and use it in GitHub Desktop.

I found these resources very helpful in learning to make better commit messages:

The best take away was the because clause. Here is my guidelines (rule of thumbs) that I abide by:

  1. Subject line is 50 character or less
  2. Subject starts with a command in present tense: "Fix", "Update", "Refactor", "Move", etc. and not "Fixes" or "Fixed".
  3. Body is wrapped at 72 characters but don't wrap URL's.
  4. Body is in Markdown syntax.
  5. Syntax for bulleted lists should use a hyphen, followed by a single space, with blank lines in between, and a hanging indent.
  6. Never use git commit -m. Instead always open in an editor. This forces you to think about the message and prevents rambling.
  7. When in doubt add the word because to the body and go from there.
  8. If the code change doesn't warrant a commit message that follows the above then you should concider rebaseing it differently.
  9. There are very little exceptions for not including a body. Noteably, a commit that bumps the repo's version number, a non fast-forward merge commit, or a no changes maintinance commit from a bot or script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment