Andrew Gerrand | 5bc444d | 2014-12-10 11:35:11 +1100 | [diff] [blame] | 1 | Be sure to familiarize yourself with the [code review process](http://golang.org/doc/contribute.html#Code_review) from the official Contribution Guidelines first. |
| 2 | |
| 3 | # Reviewer Parlance |
| 4 | |
| 5 | There are several terms code reviews may use that you should become familiar with. |
| 6 | |
Caleb Spare | 8aac574 | 2017-04-27 13:52:34 -0700 | [diff] [blame] | 7 | * ` LGTM ` — looks good to me |
| 8 | * ` SGTM ` — sounds good to me |
| 9 | * ` PTAL ` — please take a look |
| 10 | * ` s/foo/bar/ ` — please replace ` foo ` with ` bar `; this is [sed syntax](http://en.wikipedia.org/wiki/Sed#Usage) |
| 11 | * ` s/foo/bar/g ` — please replace ` foo ` with ` bar ` throughout your entire change |
| 12 | |
| 13 | # CL Directives |
| 14 | |
| 15 | * `R=foo` — assign a reviewer within the [Go CL dashboard](https://swtch.com/godash/) |
Tim Cooper | 57d4725 | 2017-09-27 15:11:06 -0300 | [diff] [blame] | 16 | * `RELNOTE=yes` or `RELNOTE=<subject>` — tag for release notes; scraped by the [relnote](https://golang.org/x/build/cmd/relnote) tool |
Caleb Spare | 8aac574 | 2017-04-27 13:52:34 -0700 | [diff] [blame] | 17 | * `DO NOT SUBMIT` (in the commit message) — block submission; see the "Work in progress" section below |
| 18 | * `Updates #1234` or `Fixes #1234` (in the commit message) — link the CL from the GitHub issue and optionally close the issue after the CL is merged |
Andrew Gerrand | 5bc444d | 2014-12-10 11:35:11 +1100 | [diff] [blame] | 19 | |
| 20 | # Email |
| 21 | |
| 22 | Messages from a code review are typically sent to three places: |
Caleb Spare | 8aac574 | 2017-04-27 13:52:34 -0700 | [diff] [blame] | 23 | |
| 24 | * the reviewers, if any |
| 25 | * the golang-codereviews group |
| 26 | * the owner |
Andrew Gerrand | 5bc444d | 2014-12-10 11:35:11 +1100 | [diff] [blame] | 27 | |
Josh Bleecher Snyder | b8f4456 | 2015-01-09 16:40:56 -0800 | [diff] [blame] | 28 | Please do NOT reply code review via email, as the message [will not be relayed to Gerrit](https://code.google.com/p/gerrit/issues/detail?id=228). Always click on the link and post reply in Gerrit. |
Andrew Gerrand | 5bc444d | 2014-12-10 11:35:11 +1100 | [diff] [blame] | 29 | |
Josh Bleecher Snyder | 5868b9f | 2015-02-03 14:49:20 -0800 | [diff] [blame] | 30 | # Work in progress |
| 31 | |
Francesc Campoy | c7b6822 | 2016-11-01 10:50:29 -0700 | [diff] [blame] | 32 | If you have changes that aren't ready to be reviewed, you can put a giant **`DO NOT REVIEW`** as the second line of the CL description, so that people who see it know not to look any further. Don't make it the first line, since then it will become the subject for the entire review, even after you've changed the description. |
Francesc Campoy | 72ebc11 | 2016-11-01 10:49:00 -0700 | [diff] [blame] | 33 | |
Francesc Campoy | c7b6822 | 2016-11-01 10:50:29 -0700 | [diff] [blame] | 34 | Similarly, if you would like to ensure that your changes are not merged by mistake, you can put **`DO NOT SUBMIT`** as the second line of the CL description. |
Josh Bleecher Snyder | 5868b9f | 2015-02-03 14:49:20 -0800 | [diff] [blame] | 35 | |
bitlux | 85f2339 | 2015-12-14 14:36:41 -0500 | [diff] [blame] | 36 | If you don't need Gerrit's features, but just want to backup your work, share work between multiple clients, or have a staging UI to examine your changes, you can use a regular git remote. |
Josh Bleecher Snyder | 5868b9f | 2015-02-03 14:49:20 -0800 | [diff] [blame] | 37 | |
| 38 | To use GitHub as a git remote, you can either fork github.com/golang/go or create a new repo. There are trade-offs. Forked repos will have a faster first push. Non-forked repos can be private. Forked repos are associated in GitHub's system. As a result, they are easily discoverable and support cross-repo comparisons in the GitHub UI; however, this also means that references to issues in commit messages in forked repos will create references to your fork in the issue. |
| 39 | |
| 40 | To add your git remote, run something like: |
| 41 | |
| 42 | ```bash |
Josh Bleecher Snyder | db54ef4 | 2015-02-03 15:32:45 -0800 | [diff] [blame] | 43 | $ git remote add fork git@github.com:yourusername/go.git |
Josh Bleecher Snyder | 5868b9f | 2015-02-03 14:49:20 -0800 | [diff] [blame] | 44 | ``` |
| 45 | |
| 46 | You can then push changes to the "fork" remote with `git push fork branchname`. |
| 47 | |
| 48 | Gerrit's code review model is to rewrite a single commit until it is correct. GitHub will try to prevent you from accidentally overwriting your existing branch. You can work around this by forcing the push: `git push --force fork branchname`. Alternatively, you can set up your forked remote as a mirror by cloning it initially with: |
| 49 | |
| 50 | ```bash |
Josh Bleecher Snyder | db54ef4 | 2015-02-03 15:32:45 -0800 | [diff] [blame] | 51 | $ git remote add --mirror=push fork git@github.com:yourusername/go.git |
Josh Bleecher Snyder | 5868b9f | 2015-02-03 14:49:20 -0800 | [diff] [blame] | 52 | ``` |
| 53 | |
alexbrainman | c5d2ff6 | 2015-02-05 14:20:32 +1100 | [diff] [blame] | 54 | Then running `git push fork` will update GitHub to perfectly mirror *everything* (all branches, all tags, etc.). This is handy, but take care when using this on multiple clients. You are bypassing the usual git safeguards, so it is easy to overwrite (and thus lose) work pushed by a different client. |