Here are some important things to think about when crafting a good commit message:
Do
Do keep the message short (less than 60-ish characters)
Do explain what commit does (not how or why!)
Don't
Do not explain why the changes are made.
Do not explain how the changes are made. (That's what git log -p is for)
Do not use the word and, if you use and, your commit message is probably doing too many changes - break the changes into separate commits.
e.g. "Make the background color pink and increase the size of the sidebar"
The best way that I've found to come up with a commit message is to finish this phrase, "This commit will...". However, you finish that phrase, use that as your commit message.
Above all, be consistent in how you write your commit messages.
Explain the Why
If you need to explain why a commit needs to be made, you can!
When you're writing the commit message, the first line is the message itself. After the message, leave a blank line, and then type out the body or explanation including details about why the commit is needed. (e.g. URL links)
This details section of a commit message is included in the git log.
Only the message (the first line) is included in git log --one-line
Here are some important things to think about when crafting a good commit message:
Do
Don't
git log -p
is for)The best way that I've found to come up with a commit message is to finish this phrase, "This commit will...". However, you finish that phrase, use that as your commit message.
Above all, be consistent in how you write your commit messages.
Explain the Why
If you need to explain why a commit needs to be made, you can!
When you're writing the commit message, the first line is the message itself. After the message, leave a blank line, and then type out the body or explanation including details about why the commit is needed. (e.g. URL links)
This details section of a commit message is included in the
git log
. Only the message (the first line) is included ingit log --one-line