Key points from Chris Beams git-commit

Purpose
I wrote this to quickly refer to the the points I found relevant in https://chris.beams.io/posts/git-commit/.
Point 1
While many repositories’ logs look like the former, there are exceptions. The Linux kernel and Git itself are great examples. Look at Spring Boot, or any repository managed by Tim Pope.
Point 2
The seven rules of a great Git commit message:
-
Separate subject from body with a blank line
-
Limit the subject line to 50 characters
-
Capitalize the subject line
-
Do not end the subject line with a period
-
Use the imperative mood in the subject line
-
Wrap the body at 72 characters
-
Use the body to explain what and why vs. how
Point 3
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
Point 4
This commit from Bitcoin Core is a great example of explaining what changed and why:
commit eb0b56b19017ab5c16c745e6da39c53126924ed6
Author: Pieter Wuille
Date: Fri Aug 1 22:57:55 2014 +0200
Simplify serialize.h's exception handling
Remove the 'state' and 'exceptmask' from serialize.h's stream
implementations, as well as related methods.
As exceptmask always included 'failbit', and setstate was always
called with bits = failbit, all it did was immediately raise an
exception. Get rid of those variables, and replace the setstate
with direct exception throwing (which also removes some dead
code).
As a result, good() is never reached after a failure (there are
only 2 calls, one of which is in tests), and can just be replaced
by !eof().
fail(), clear(n) and exceptions() are just never called. Delete
them.
Point 5
Read Pro Git
Additional Links
-
Documentation on how to contribute to Linux kernel
-
Specific doc on formatting a patch
Content Cited
-
Content from https://chris.beams.io/posts/git-commit/
-
git image from https://git-scm.com/images/logos/downloads/Git-Logo-2Color.png found by Googling “git” images on 2017-10-14