Brad Fitzpatrick | d344569 | 2018-02-09 12:24:36 -0800 | [diff] [blame] | 1 | # Commit messages |
| 2 | |
Brad Fitzpatrick | 98357a1 | 2018-05-15 12:26:33 -0400 | [diff] [blame] | 3 | Commit messages, also known as CL (changelist) descriptions, should be formatted per https://tip.golang.org/doc/contribute.html#commit_messages . For example, |
Brad Fitzpatrick | d344569 | 2018-02-09 12:24:36 -0800 | [diff] [blame] | 4 | |
| 5 | ``` |
| 6 | net/http: frob the quux before blarfing |
| 7 | |
Alberto Donizetti | 9d49d50 | 2018-04-16 10:19:19 +0200 | [diff] [blame] | 8 | [longer description here in the body] |
| 9 | |
Brad Fitzpatrick | d344569 | 2018-02-09 12:24:36 -0800 | [diff] [blame] | 10 | Fixes #nnnn |
| 11 | ``` |
| 12 | |
Alberto Donizetti | 9d49d50 | 2018-04-16 10:19:19 +0200 | [diff] [blame] | 13 | Notably, for the subject (the first line of description): |
Brad Fitzpatrick | d344569 | 2018-02-09 12:24:36 -0800 | [diff] [blame] | 14 | |
Alberto Donizetti | 9d49d50 | 2018-04-16 10:19:19 +0200 | [diff] [blame] | 15 | * the name of the package affected by the change goes before the colon |
Brad Fitzpatrick | d344569 | 2018-02-09 12:24:36 -0800 | [diff] [blame] | 16 | * the part after the colon uses the verb tense + phrase that completes the blank in, *"This change modifies Go to ___________"* |
Alberto Donizetti | 9d49d50 | 2018-04-16 10:19:19 +0200 | [diff] [blame] | 17 | * the verb after the colon is lowercase |
| 18 | * there is no trailing period |
Brad Fitzpatrick | 98357a1 | 2018-05-15 12:26:33 -0400 | [diff] [blame] | 19 | * it should be kept as short as possible (many git viewing tools prefer under ~76 characters, though Go isn't super strict about this). |
Alberto Donizetti | 9d49d50 | 2018-04-16 10:19:19 +0200 | [diff] [blame] | 20 | |
| 21 | For the body (the rest of the description): |
| 22 | |
Brad Fitzpatrick | 98357a1 | 2018-05-15 12:26:33 -0400 | [diff] [blame] | 23 | * the text should be wrapped to ~76 characters (to appease git viewing tools, mainly), unless you really need longer lines (e.g. for ASCII art, tables, or long links) |
Alberto Donizetti | 9d49d50 | 2018-04-16 10:19:19 +0200 | [diff] [blame] | 24 | * the Fixes/Updates line goes after the body with a blank newline separating the two |
| 25 | * there is **no** Markdown in the commit message |
| 26 | * we **do not** use `Signed-off-by` lines. Don't add them. Our Gerrit server & GitHub bots enforce CLA compliance instead. |
Brad Fitzpatrick | d344569 | 2018-02-09 12:24:36 -0800 | [diff] [blame] | 27 | |
| 28 | If it's not a complete fix and more is coming, use: |
| 29 | |
| 30 | ``` |
Alberto Donizetti | 9d49d50 | 2018-04-16 10:19:19 +0200 | [diff] [blame] | 31 | Updates #nnnn |
Brad Fitzpatrick | d344569 | 2018-02-09 12:24:36 -0800 | [diff] [blame] | 32 | ``` |
| 33 | |
Alberto Donizetti | 9d49d50 | 2018-04-16 10:19:19 +0200 | [diff] [blame] | 34 | instead of `Fixes`. Don't use the other GitHub-supported verbs. |
Brad Fitzpatrick | d344569 | 2018-02-09 12:24:36 -0800 | [diff] [blame] | 35 | |
| 36 | # Other repos |
| 37 | |
| 38 | For non-"go" repos ("crypto", "tools", "net", etc), the subject is still the name of the package, but you need to fully-qualify the issue number with the GitHub org/repo syntax: |
| 39 | |
| 40 | ``` |
| 41 | cipher/rot13: add new super secure cipher |
| 42 | |
| 43 | Fixes golang/go#1234 |
| 44 | ```` |
Brad Fitzpatrick | c1534fe | 2018-02-09 12:26:49 -0800 | [diff] [blame] | 45 | |
| 46 | Notably, the first line subject should **not** contain the `x/crypto/` prefix. We only do that for the issue tracker. |
| 47 | |
Mikio Hara | 0e0a673 | 2018-02-10 08:12:03 +0900 | [diff] [blame] | 48 | # Non-normative references |
| 49 | |
| 50 | - [Please heed my plea and write good CL descriptions for Go—and for any other project you work on.](https://groups.google.com/d/msg/golang-dev/6M4dmZWpFaI/SyU5Sl4zZLYJ) |
| 51 | - [The CL description is a public document that explains to the future what has been done and why.](https://groups.google.com/d/msg/golang-dev/s07ZUR8ZDHo/i-rIsknbAwAJ) |
| 52 | |
Brad Fitzpatrick | 7ca29b1 | 2018-02-13 13:32:59 -0800 | [diff] [blame] | 53 | # GitHub Pull Requests |
| 54 | |
| 55 | If you're using GitHub Pull Requests, your commit message is constructed by GerritBot based on your |
| 56 | PR's title & description. See https://github.com/golang/go/wiki/GerritBot#how-does-gerritbot-determine-the-final-commit-message |
| 57 | |
| 58 | If somebody asks you to modify your commit message, you'll need to modify your PR. |