Git commit messages - nrc-cnrc/EGSnrc GitHub Wiki

Listed below are a few recommendations to ensure commit messages in the EGSnrc repository are consistent and compatible with a variety of git tools. For a more detailed explanation of why these things matter, read http://chris.beams.io/posts/git-commit/.

  1. Spell check commit messages: they are public and permanent
  2. Avoid private information, derogatory comments, etc., for the same reason
  3. Limit the title (first line) of your commit message to 50 characters
  4. Capitalize the title, and do not put a period . at the end of the line
  5. Leave the second line blank and start the body of the message on line 3
  6. When fixing issue number nnn, title the commit Fix #nnn: ...
  7. When merging pull request number nnn, title the commit Merge #nnn: ...
  8. Start with a lowercase letter after a :
  9. Optionally, end the title with the pull request number nnn, formatted (#nnn)
  10. Justify the body of the message to a width of 72 characters
  11. Favour an imperative mood (e.g., "Add new feature x" instead of "Added feature x")

Acknowledgements

When the commit follows from someone else's report, suggestion or comment (which was not submitted via an issue or pull request), acknowledge the source in parenthesis at the end of the message, as in "(Error reported by John Smith)". Do not use the term "contributed by", which is reserved for people who modified the code.

Corrections

If you notice any problem in your latest commit, such as a typo or a file added by mistake, fix it immediately using git commit --amend. This only works for the most recent commit, and only until it is pushed upstream to the origin of your local branch.