Debian Codegraph @

Documentation/contributing/git_commit_messages.md

raw symbols SCIP
1 # Git Commit messages
2
3 There are a number of different recommendations for git commit
4 messages, so this is another one.
5
6 It's expected that coreboot contributors already generally understand
7 the idea of writing good git commit messages, so this is not trying
8 to go over everything again. There are other tutorials that cover that.
9
10 - [Linux Kernel tip tree Handbook](https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#patch-subject)
11 - [How to write a Git Commit Message](https://cbea.ms/git-commit/)
12
13 ## Line length
14
15 - The subject line should be <= 65 characters, with an absolute maximum
16 of 72 characters
17 - Prose in the commit message should be <= 72 characters
18 - If reflowing prose to 72 characters can reduce the length of the
19 commit message by 2 or more lines, please reflow it. Using the entire
20 72 characters on a line when reasonable is recommended, but not
21 required.
22 - Non-prose text in the body in the commit message does not need to be
23 wrapped at 72 characters. Examples: URLs, compiler output, or poetry.
24
25 ## Both Subject & body
26
27 - Use the present tense. (The for loop exits too early, so ...", not
28 "The for loop exited too early, so ...").
29 - When using acronyms, make sure they're explained in the commit
30 message itself or in the [acronyms list](https://doc.coreboot.org/acronyms.html).
31
32 ## Commit message Subject Line
33
34 - Start the subject line with a prefix denoting the area of the change.
35 Often part of the path can be used by that. Looking through existing
36 commit messages summaries with `git log --oneline ...` gives a good
37 idea. Because this prefix takes space used by the rest of the subject,
38 it should be kept short while still uniquely describing the area.
39 - Don't include `src/`
40 - Use abbreviations where possible:
41 - mb: mainboard
42 - vc: vendorcode
43 - Don't end the subject line with a period.
44 - Use the imperative mood. ("Fix whitespace", not "whitespace fixes").
45
46 ## Commit Message Body
47
48 - Make sure the problem being solved by the commit is described. While
49 it may be obvious to the committer, it may not be obvious to others.
50 - When referencing other commits use a 12 character hash and the subject
51 (e.g. `commit XXXXXXXXXXXX ("some commit")`). However, use `CB:XXXXX`
52 when referring to an open or abandoned change on Gerrit.
53 - When using a URL in a commit message, use archive.org when possible.
54 URLs often get changed or go stale, so this keeps them stable.
55 - Make sure that all changes in a patch are addressed in the commit
56 message.
57 - A TEST= tag is highly recommended, but not required. This lets people
58 know whether you tested it by booting the board or just by compiling.
59 - All but the most trivial of patches should generally have a body.
60 - A BUG= tag can be added when the author wants to indicate that the
61 patch is or is not related to a bug. This can be either in coreboot's
62 issue tracker, or a private issue tracker.
63 - `BUG=b:####` is used by the Google internal issue tracker.
64 - `BUG=chromium:####` indicates the Chromium public tracker at
65 https://issues.chromium.org/
66 - `BUG=CID ####` can be used to indicate coverity error fixes.
67 - `BUG=https://...` can be used to link directly to a public
68 tracker.
69 - The BRANCH= tag is used in cases where a patch needs to be added to a
70 specific downstream branch. This is never required by the coreboot
71 project.
72
73 ## Footers
74
75 - The Signed-off-by line is required (Jenkins forces this).
76 - The Change ID is required (Gerrit forces this.)
77 - When adding a patch that has already gone through another git or
78 gerrit, the footers from those previous commits may be added, but
79 keep the list reasonable.