blob: caba170549bfc9c85dee36fb1e61766025e86659 [file] [log] [blame] [view]
Brad Fitzpatrickd3445692018-02-09 12:24:36 -08001# Commit messages
2
Brad Fitzpatrick98357a12018-05-15 12:26:33 -04003Commit messages, also known as CL (changelist) descriptions, should be formatted per https://tip.golang.org/doc/contribute.html#commit_messages . For example,
Brad Fitzpatrickd3445692018-02-09 12:24:36 -08004
5```
6net/http: frob the quux before blarfing
7
Alberto Donizetti9d49d502018-04-16 10:19:19 +02008[longer description here in the body]
9
Brad Fitzpatrickd3445692018-02-09 12:24:36 -080010Fixes #nnnn
11```
12
Alberto Donizetti9d49d502018-04-16 10:19:19 +020013Notably, for the subject (the first line of description):
Brad Fitzpatrickd3445692018-02-09 12:24:36 -080014
Alberto Donizetti9d49d502018-04-16 10:19:19 +020015* the name of the package affected by the change goes before the colon
Brad Fitzpatrickd3445692018-02-09 12:24:36 -080016* the part after the colon uses the verb tense + phrase that completes the blank in, *"This change modifies Go to ___________"*
Alberto Donizetti9d49d502018-04-16 10:19:19 +020017* the verb after the colon is lowercase
18* there is no trailing period
Brad Fitzpatrick98357a12018-05-15 12:26:33 -040019* 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 Donizetti9d49d502018-04-16 10:19:19 +020020
21For the body (the rest of the description):
22
Brad Fitzpatrick98357a12018-05-15 12:26:33 -040023* 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 Donizetti9d49d502018-04-16 10:19:19 +020024* 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 Fitzpatrickd3445692018-02-09 12:24:36 -080027
28If it's not a complete fix and more is coming, use:
29
30```
Alberto Donizetti9d49d502018-04-16 10:19:19 +020031Updates #nnnn
Brad Fitzpatrickd3445692018-02-09 12:24:36 -080032```
33
Alberto Donizetti9d49d502018-04-16 10:19:19 +020034instead of `Fixes`. Don't use the other GitHub-supported verbs.
Brad Fitzpatrickd3445692018-02-09 12:24:36 -080035
36# Other repos
37
38For 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```
41cipher/rot13: add new super secure cipher
42
43Fixes golang/go#1234
44````
Brad Fitzpatrickc1534fe2018-02-09 12:26:49 -080045
46Notably, the first line subject should **not** contain the `x/crypto/` prefix. We only do that for the issue tracker.
47
Mikio Hara0e0a6732018-02-10 08:12:03 +090048# 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 Fitzpatrick7ca29b12018-02-13 13:32:59 -080053# GitHub Pull Requests
54
55If you're using GitHub Pull Requests, your commit message is constructed by GerritBot based on your
56PR's title & description. See https://github.com/golang/go/wiki/GerritBot#how-does-gerritbot-determine-the-final-commit-message
57
58If somebody asks you to modify your commit message, you'll need to modify your PR.