Brad Fitzpatrick | d344569 | 2018-02-09 12:24:36 -0800 | [diff] [blame] | 1 | # Commit messages |
| 2 | |
Mikio Hara | 0e0a673 | 2018-02-10 08:12:03 +0900 | [diff] [blame] | 3 | Commit messages, also known as CL (changelist) descriptions, for Go repos should be formatted as follows: |
Brad Fitzpatrick | d344569 | 2018-02-09 12:24:36 -0800 | [diff] [blame] | 4 | |
| 5 | ``` |
| 6 | net/http: frob the quux before blarfing |
| 7 | |
| 8 | Fixes #nnnn |
| 9 | ``` |
| 10 | |
| 11 | Notably, |
| 12 | |
| 13 | * the package name goes before the colon |
| 14 | * the part after the colon uses the verb tense + phrase that completes the blank in, *"This change modifies Go to ___________"* |
| 15 | * lowercase verb after the colon |
| 16 | * no trailing period |
Brad Fitzpatrick | c1534fe | 2018-02-09 12:26:49 -0800 | [diff] [blame] | 17 | * keep the subject (first line) as short as possible. ideally under 76 characters or shorter. |
| 18 | * keep the body wrapped too, also max 76, unless it's really needed (ASCII art, table, or long link) |
Andrew Bonventre | 7ae4c55 | 2018-03-05 11:46:06 -0500 | [diff] [blame] | 19 | * the Fixes/Updates line should be after the body with a blank newline separating the two |
Brad Fitzpatrick | c1534fe | 2018-02-09 12:26:49 -0800 | [diff] [blame] | 20 | * no Markdown |
Brad Fitzpatrick | a9bd54c | 2018-02-15 07:58:36 -0800 | [diff] [blame] | 21 | * we **do not** use `Signed-off-by` lines in Go. Please 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] | 22 | |
| 23 | If it's not a complete fix and more is coming, use: |
| 24 | |
| 25 | ``` |
| 26 | Updates #nnn |
| 27 | ``` |
| 28 | |
| 29 | ... instead of `Fixes`. Don't use the other GitHub-supported verbs. |
| 30 | |
| 31 | # Other repos |
| 32 | |
| 33 | 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: |
| 34 | |
| 35 | ``` |
| 36 | cipher/rot13: add new super secure cipher |
| 37 | |
| 38 | Fixes golang/go#1234 |
| 39 | ```` |
Brad Fitzpatrick | c1534fe | 2018-02-09 12:26:49 -0800 | [diff] [blame] | 40 | |
| 41 | Notably, the first line subject should **not** contain the `x/crypto/` prefix. We only do that for the issue tracker. |
| 42 | |
Mikio Hara | 0e0a673 | 2018-02-10 08:12:03 +0900 | [diff] [blame] | 43 | # Non-normative references |
| 44 | |
| 45 | - [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) |
| 46 | - [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) |
| 47 | |
Brad Fitzpatrick | 7ca29b1 | 2018-02-13 13:32:59 -0800 | [diff] [blame] | 48 | # GitHub Pull Requests |
| 49 | |
| 50 | If you're using GitHub Pull Requests, your commit message is constructed by GerritBot based on your |
| 51 | PR's title & description. See https://github.com/golang/go/wiki/GerritBot#how-does-gerritbot-determine-the-final-commit-message |
| 52 | |
| 53 | If somebody asks you to modify your commit message, you'll need to modify your PR. |