Why is message convention important?
– reading logs – it’s easier to read concise and consistent messages (git log and related tools)
– diff will tell you what changed, but only the commit message can properly tell you why
Teams should first agree on a commit message convention:
Rules for a great Git commit message
1. Separate subject from body with a blank line
Begin the commit message with a single short (less than 50 character) line summarizing the change, followed by a blank line and then a more thorough description. The text up to the first blank line in a commit message is treated as the commit title, and that title is used throughout Git.
– if the change is simple, a single line might be sufficient
– the separation of subject from body pays off when browsing the log
2. Limit the subject line to 50 characters
If you’re having a hard time summarizing, you might be committing too many changes at once.
3. Capitalize the subject line
Begin all subject lines with a capital letter.
4. Do not end the subject line with a period
Space is precious when you’re trying to keep them to 50 chars or less.
5. Use the imperative mood in the subject line
Imperative mood means “spoken or written as if giving a command or instruction”.
Always be able to complete the following sentence:
6. Wrap the body at 72 characters
Git never wraps text automatically.
7. Use the body to explain what and why vs. how
Make clear reasons why you made the change, how things worked before the change and why you decided to solve it the way you did.
Last update 22.11.2018.
For possible mistakes in content or typos, I apologise and kindly ask you to report here.