Andrew Gerrand | 7cb21a7 | 2012-01-19 11:24:54 +1100 | [diff] [blame] | 1 | <!--{ |
| 2 | "Title": "Contribution Guidelines" |
| 3 | }--> |
Russ Cox | fb39a4d | 2009-10-23 15:24:08 -0700 | [diff] [blame] | 4 | |
Russ Cox | 6c7f9f6 | 2009-11-09 16:56:17 -0800 | [diff] [blame] | 5 | <h2 id="Introduction">Introduction</h2> |
Rob Pike | 5b72f9c | 2009-11-01 20:48:21 -0800 | [diff] [blame] | 6 | |
| 7 | <p> |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 8 | This document explains how to contribute changes to the Go project. |
Andrew Gerrand | 968f0df | 2014-12-12 13:53:29 +1100 | [diff] [blame] | 9 | It assumes you have followed the |
Jonathan Feinberg | 452f40f | 2012-09-26 14:39:31 -0400 | [diff] [blame] | 10 | <a href="/doc/install/source">installation instructions</a> and |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 11 | have <a href="code.html">written and tested your code</a>. |
Andrew Gerrand | 968f0df | 2014-12-12 13:53:29 +1100 | [diff] [blame] | 12 | </p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 13 | |
| 14 | <p> |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 15 | (Note that the <code>gccgo</code> frontend lives elsewhere; |
Ian Lance Taylor | 2528f33 | 2009-11-06 14:15:41 -0800 | [diff] [blame] | 16 | see <a href="gccgo_contribute.html">Contributing to gccgo</a>.) |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 17 | </p> |
Russ Cox | fb39a4d | 2009-10-23 15:24:08 -0700 | [diff] [blame] | 18 | |
Rob Pike | 96ee38b | 2009-12-17 12:12:47 +1100 | [diff] [blame] | 19 | <h2 id="Design">Discuss your design</h2> |
| 20 | |
| 21 | <p> |
| 22 | The project welcomes submissions but please let everyone know what |
Andrew Gerrand | 3c10bdd | 2015-07-31 11:43:57 +1000 | [diff] [blame] | 23 | you're working on if you want to change or add to the Go repositories. |
Rob Pike | 96ee38b | 2009-12-17 12:12:47 +1100 | [diff] [blame] | 24 | </p> |
| 25 | |
| 26 | <p> |
Andy Maloney | c53de85 | 2015-08-03 10:15:52 -0400 | [diff] [blame] | 27 | Before undertaking to write something new for the Go project, |
Andrew Gerrand | 3c10bdd | 2015-07-31 11:43:57 +1000 | [diff] [blame] | 28 | please <a href="https://golang.org/issue/new">file an issue</a> |
| 29 | (or claim an <a href="https://golang.org/issues">existing issue</a>). |
| 30 | Significant changes must go through the |
| 31 | <a href="https://golang.org/s/proposal-process">change proposal process</a> |
| 32 | before they can be accepted. |
Rob Pike | 96ee38b | 2009-12-17 12:12:47 +1100 | [diff] [blame] | 33 | </p> |
| 34 | |
| 35 | <p> |
Andrew Gerrand | 3c10bdd | 2015-07-31 11:43:57 +1000 | [diff] [blame] | 36 | This process gives everyone a chance to validate the design, |
| 37 | helps prevent duplication of effort, |
| 38 | and ensures that the idea fits inside the goals for the language and tools. |
| 39 | It also checks that the design is sound before code is written; |
| 40 | the code review tool is not the place for high-level discussions. |
Rob Pike | 96ee38b | 2009-12-17 12:12:47 +1100 | [diff] [blame] | 41 | </p> |
| 42 | |
Caleb Spare | 2bd5237 | 2015-08-03 17:48:43 -0700 | [diff] [blame] | 43 | <p> |
| 44 | When planning work, please note that the Go project follows a |
| 45 | <a href="https://golang.org/wiki/Go-Release-Cycle">six-month |
| 46 | development cycle</a>. The latter half of each cycle is a three-month |
| 47 | feature freeze during which only bug fixes and doc updates are accepted. |
| 48 | New work cannot be submitted during a feature freeze. |
| 49 | </p> |
| 50 | |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 51 | <h2 id="Testing">Testing redux</h2> |
Russ Cox | 830813f | 2009-11-08 21:08:27 -0800 | [diff] [blame] | 52 | |
| 53 | <p> |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 54 | You've <a href="code.html">written and tested your code</a>, but |
| 55 | before sending code out for review, run all the tests for the whole |
| 56 | tree to make sure the changes don't break other packages or programs: |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 57 | </p> |
| 58 | |
| 59 | <pre> |
Nathan John Youngman | d5f208c | 2014-03-17 09:35:04 +1100 | [diff] [blame] | 60 | $ cd go/src |
| 61 | $ ./all.bash |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 62 | </pre> |
| 63 | |
| 64 | <p> |
Nathan John Youngman | d5f208c | 2014-03-17 09:35:04 +1100 | [diff] [blame] | 65 | (To build under Windows use <code>all.bat</code>.) |
| 66 | </p> |
| 67 | |
| 68 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 69 | After running for a while, the command should print |
| 70 | "<code>ALL</code> <code>TESTS</code> <code>PASSED</code>". |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 71 | </p> |
| 72 | |
Russ Cox | 6c7f9f6 | 2009-11-09 16:56:17 -0800 | [diff] [blame] | 73 | <h2 id="Code_review">Code review</h2> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 74 | |
| 75 | <p> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 76 | Changes to Go must be reviewed before they are accepted, |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 77 | no matter who makes the change. |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 78 | A custom git command called <code>git-codereview</code>, |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 79 | discussed below, helps manage the code review process through a Google-hosted |
| 80 | <a href="https://go-review.googlesource.com/">instance</a> of the code review |
| 81 | system called <a href="https://code.google.com/p/gerrit/">Gerrit</a>. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 82 | </p> |
| 83 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 84 | <h3>Set up authentication for code review</h3> |
Russ Cox | 9ad14c9 | 2009-11-06 10:33:46 -0800 | [diff] [blame] | 85 | |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 86 | <p> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 87 | Gerrit uses Google Accounts for authentication. If you don't have |
| 88 | a Google Account, you can create an account which |
| 89 | <a href="https://www.google.com/accounts/NewAccount">includes |
| 90 | a new Gmail email account</a> or create an account associated |
| 91 | <a href="https://accounts.google.com/SignUpWithoutGmail">with your existing |
| 92 | email address</a>. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 93 | </p> |
| 94 | |
| 95 | <p> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 96 | The email address associated with the Google Account you use will be recorded in |
| 97 | the <a href="https://go.googlesource.com/go/+log/">change log</a> |
| 98 | and in the <a href="/CONTRIBUTORS">contributors file</a>. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 99 | </p> |
| 100 | |
| 101 | <p> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 102 | To set up your account in Gerrit, visit |
| 103 | <a href="https://go.googlesource.com">go.googlesource.com</a> |
| 104 | and click on "Generate Password" in the page's top right menu bar. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 105 | </p> |
| 106 | |
| 107 | <p> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 108 | You will be redirected to accounts.google.com to sign in. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 109 | </p> |
| 110 | |
| 111 | <p> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 112 | Once signed in, you are returned back to go.googlesource.com to "Configure Git". |
| 113 | Follow the instructions on the page. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 114 | (If you are on a Windows computer, you should instead follow the instructions |
| 115 | in the yellow box to run the command.) |
| 116 | </p> |
| 117 | |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 118 | <p> |
| 119 | Your secret authentication token is now in a <code>.gitcookie</code> file |
| 120 | and Git is configured to use this file. |
| 121 | </p> |
| 122 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 123 | <h3>Register with Gerrit</h3> |
| 124 | |
| 125 | <p> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 126 | Now that you have your authentication token, |
| 127 | you need to register your account with Gerrit. |
| 128 | To do this, visit |
| 129 | <a href="https://go-review.googlesource.com/login/"> |
| 130 | go-review.googlesource.com/login/</a>. You will immediately be redirected |
| 131 | to Google Accounts. Sign in using the same Google Account you used above. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 132 | That is all that is required. |
| 133 | </p> |
| 134 | |
Andy Maloney | c53de85 | 2015-08-03 10:15:52 -0400 | [diff] [blame] | 135 | <h3>Contributor License Agreement</h3> |
| 136 | |
| 137 | <p>Gerrit serves as the gatekeeper and uses your e-mail address as the key. |
| 138 | To send your first change to the Go project from a given address, |
| 139 | you must have completed one of the contributor license agreements: |
| 140 | <ul> |
| 141 | <li> |
| 142 | If you are the copyright holder, you will need to agree to the |
| 143 | <a href="https://developers.google.com/open-source/cla/individual">individual |
| 144 | contributor license agreement</a>, which can be completed online. |
| 145 | </li> |
| 146 | <li> |
| 147 | If your organization is the copyright holder, the organization |
| 148 | will need to agree to the |
| 149 | <a href="https://developers.google.com/open-source/cla/corporate">corporate |
| 150 | contributor license agreement</a>. |
| 151 | (If the copyright holder for your code has already completed the |
| 152 | agreement in connection with another Google open source project, |
| 153 | it does not need to be completed again.) |
| 154 | </li> |
| 155 | </ul> |
| 156 | |
| 157 | <p> |
| 158 | You can use the links above to create and sign the contributor license agreement |
| 159 | or you can show your current agreements and create new ones through the Gerrit |
| 160 | interface. <a href="https://go-review.googlesource.com/login/">Log into Gerrit</a>, |
| 161 | click your name in the upper-right, choose "Settings", then select "Agreements" |
| 162 | from the topics on the left. If you do not have a signed agreement listed here, |
| 163 | you can create one by clicking "New Contributor Agreement" and following the steps. |
| 164 | </p> |
| 165 | |
| 166 | <p> |
| 167 | This rigmarole only needs to be done for your first submission for each email address. |
| 168 | </p> |
| 169 | |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 170 | <h3>Install the git-codereview command</h3> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 171 | |
| 172 | <p> |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 173 | Now install the <code>git-codereview</code> command by running, |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 174 | </p> |
| 175 | |
| 176 | <pre> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 177 | $ go get -u golang.org/x/review/git-codereview |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 178 | </pre> |
| 179 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 180 | <p> |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 181 | Make sure <code>git-codereview</code> is installed in your shell path, so that the |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 182 | <code>git</code> command can find it. Check that |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 183 | </p> |
| 184 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 185 | <pre> |
Andrew Gerrand | 0293b7e | 2014-12-18 12:55:22 +1100 | [diff] [blame] | 186 | $ git codereview help |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 187 | </pre> |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 188 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 189 | <p> |
| 190 | prints help text, not an error. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 191 | </p> |
| 192 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 193 | <p> |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 194 | Note to Git aficionados: The <code>git-codereview</code> command is not required to |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 195 | upload and manage Gerrit code reviews. For those who prefer plain Git, the text |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 196 | below gives the Git equivalent of each git-codereview command. If you do use plain |
| 197 | Git, note that you still need the commit hooks that the git-codereview command |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 198 | configures; those hooks add a Gerrit <code>Change-Id</code> line to the commit |
| 199 | message and check that all Go source files have been formatted with gofmt. Even |
| 200 | if you intend to use plain Git for daily work, install the hooks in a new Git |
Oling Cat | ce36552 | 2014-12-14 14:32:56 +0800 | [diff] [blame] | 201 | checkout by running <code>git-codereview</code> <code>hooks</code>. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 202 | </p> |
| 203 | |
| 204 | <h3>Set up git aliases</h3> |
| 205 | |
| 206 | <p> |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 207 | The <code>git-codereview</code> command can be run directly from the shell |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 208 | by typing, for instance, |
| 209 | </p> |
| 210 | |
| 211 | <pre> |
Andrew Gerrand | 0293b7e | 2014-12-18 12:55:22 +1100 | [diff] [blame] | 212 | $ git codereview sync |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 213 | </pre> |
| 214 | |
| 215 | <p> |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 216 | but it is more convenient to set up aliases for <code>git-codereview</code>'s own |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 217 | subcommands, so that the above becomes, |
| 218 | </p> |
| 219 | |
| 220 | <pre> |
| 221 | $ git sync |
| 222 | </pre> |
| 223 | |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 224 | <p> |
| 225 | The <code>git-codereview</code> subcommands have been chosen to be distinct from |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 226 | Git's own, so it's safe to do so. |
| 227 | </p> |
| 228 | |
| 229 | <p> |
| 230 | The aliases are optional, but in the rest of this document we will assume |
| 231 | they are installed. |
| 232 | To install them, copy this text into your Git configuration file |
| 233 | (usually <code>.gitconfig</code> in your home directory): |
| 234 | </p> |
| 235 | |
| 236 | <pre> |
| 237 | [alias] |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 238 | change = codereview change |
| 239 | gofmt = codereview gofmt |
| 240 | mail = codereview mail |
| 241 | pending = codereview pending |
| 242 | submit = codereview submit |
| 243 | sync = codereview sync |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 244 | </pre> |
| 245 | |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 246 | <h3>Understanding the git-codereview command</h3> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 247 | |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 248 | <p>After installing the <code>git-codereview</code> command, you can run</p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 249 | |
| 250 | <pre> |
Andrew Gerrand | 0293b7e | 2014-12-18 12:55:22 +1100 | [diff] [blame] | 251 | $ git codereview help |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 252 | </pre> |
| 253 | |
| 254 | <p> |
| 255 | to learn more about its commands. |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 256 | You can also read the <a href="https://godoc.org/golang.org/x/review/git-codereview">command documentation</a>. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 257 | </p> |
| 258 | |
| 259 | <h3>Switch to the master branch</h3> |
Andrew Gerrand | 3238705 | 2012-06-05 00:55:45 +1000 | [diff] [blame] | 260 | |
| 261 | <p> |
| 262 | Most Go installations use a release branch, but new changes should |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 263 | only be made based on the master branch. |
| 264 | (They may be applied later to a release branch as part of the release process, |
| 265 | but most contributors won't do this themselves.) |
| 266 | Before making a change, make sure you start on the master branch: |
Andrew Gerrand | 3238705 | 2012-06-05 00:55:45 +1000 | [diff] [blame] | 267 | </p> |
| 268 | |
| 269 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 270 | $ git checkout master |
| 271 | $ git sync |
Andrew Gerrand | 3238705 | 2012-06-05 00:55:45 +1000 | [diff] [blame] | 272 | </pre> |
| 273 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 274 | <p> |
| 275 | (In Git terms, <code>git</code> <code>sync</code> runs |
| 276 | <code>git</code> <code>pull</code> <code>-r</code>.) |
| 277 | </p> |
| 278 | |
Russ Cox | 9ad14c9 | 2009-11-06 10:33:46 -0800 | [diff] [blame] | 279 | <h3>Make a change</h3> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 280 | |
| 281 | <p> |
| 282 | The entire checked-out tree is writable. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 283 | Once you have edited files, you must tell Git that they have been modified. |
| 284 | You must also tell Git about any files that are added, removed, or renamed files. |
| 285 | These operations are done with the usual Git commands, |
| 286 | <code>git</code> <code>add</code>, |
| 287 | <code>git</code> <code>rm</code>, |
| 288 | and |
| 289 | <code>git</code> <code>mv</code>. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 290 | </p> |
| 291 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 292 | <p> |
| 293 | If you wish to checkpoint your work, or are ready to send the code out for review, run</p> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 294 | |
| 295 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 296 | $ git change <i><branch></i> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 297 | </pre> |
| 298 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 299 | <p> |
| 300 | from any directory in your Go repository to commit the changes so far. |
| 301 | The name <i><branch></i> is an arbitrary one you choose to identify the |
| 302 | local branch containing your changes. |
| 303 | </p> |
| 304 | |
| 305 | <p> |
| 306 | (In Git terms, <code>git</code> <code>change</code> <code><branch></code> |
| 307 | runs <code>git</code> <code>checkout</code> <code>-b</code> <code>branch</code>, |
| 308 | then <code>git</code> <code>branch</code> <code>--set-upstream-to</code> <code>origin/master</code>, |
| 309 | then <code>git</code> <code>commit</code>.) |
| 310 | </p> |
| 311 | |
| 312 | <p> |
| 313 | Git will open a change description file in your editor. |
| 314 | (It uses the editor named by the <code>$EDITOR</code> environment variable, |
| 315 | <code>vi</code> by default.) |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 316 | The file will look like: |
| 317 | </p> |
| 318 | |
| 319 | <pre> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 320 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 321 | # Please enter the commit message for your changes. Lines starting |
| 322 | # with '#' will be ignored, and an empty message aborts the commit. |
| 323 | # On branch foo |
| 324 | # Changes not staged for commit: |
| 325 | # modified: editedfile.go |
| 326 | # |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 327 | </pre> |
| 328 | |
| 329 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 330 | At the beginning of this file is a blank line; replace it |
| 331 | with a thorough description of your change. |
Nigel Tao | 3f38342 | 2011-01-05 13:00:08 +1100 | [diff] [blame] | 332 | The first line of the change description is conventionally a one-line |
| 333 | summary of the change, prefixed by the primary affected package, |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 334 | and is used as the subject for code review mail. |
| 335 | The rest of the |
| 336 | description elaborates and should provide context for the |
| 337 | change and explain what it does. |
| 338 | If there is a helpful reference, mention it here. |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 339 | </p> |
| 340 | |
| 341 | <p> |
| 342 | After editing, the template might now read: |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 343 | </p> |
| 344 | |
| 345 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 346 | math: improved Sin, Cos and Tan precision for very large arguments |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 347 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 348 | The existing implementation has poor numerical properties for |
| 349 | large arguments, so use the McGillicutty algorithm to improve |
| 350 | accuracy above 1e10. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 351 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 352 | The algorithm is described at http://wikipedia.org/wiki/McGillicutty_Algorithm |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 353 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 354 | Fixes #159 |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 355 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 356 | # Please enter the commit message for your changes. Lines starting |
| 357 | # with '#' will be ignored, and an empty message aborts the commit. |
| 358 | # On branch foo |
| 359 | # Changes not staged for commit: |
| 360 | # modified: editedfile.go |
| 361 | # |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 362 | </pre> |
| 363 | |
| 364 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 365 | The commented section of the file lists all the modified files in your client. |
| 366 | It is best to keep unrelated changes in different change lists, |
| 367 | so if you see a file listed that should not be included, abort |
| 368 | the command and move that file to a different branch. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 369 | </p> |
| 370 | |
| 371 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 372 | The special notation "Fixes #159" associates the change with issue 159 in the |
| 373 | <a href="https://golang.org/issue/159">Go issue tracker</a>. |
| 374 | When this change is eventually submitted, the issue |
| 375 | tracker will automatically mark the issue as fixed. |
| 376 | (There are several such conventions, described in detail in the |
| 377 | <a href="https://help.github.com/articles/closing-issues-via-commit-messages/">GitHub Issue Tracker documentation</a>.) |
| 378 | </p> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 379 | |
| 380 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 381 | Once you have finished writing the commit message, |
| 382 | save the file and exit the editor. |
| 383 | </p> |
| 384 | |
| 385 | <p> |
| 386 | If you wish to do more editing, re-stage your changes using |
| 387 | <code>git</code> <code>add</code>, and then run |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 388 | </p> |
| 389 | |
| 390 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 391 | $ git change |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 392 | </pre> |
| 393 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 394 | <p> |
| 395 | to update the change description and incorporate the staged changes. The |
| 396 | change description contains a <code>Change-Id</code> line near the bottom, |
| 397 | added by a Git commit hook during the initial |
| 398 | <code>git</code> <code>change</code>. |
| 399 | That line is used by Gerrit to match successive uploads of the same change. |
| 400 | Do not edit or delete it. |
| 401 | </p> |
| 402 | |
| 403 | <p> |
| 404 | (In Git terms, <code>git</code> <code>change</code> with no branch name |
| 405 | runs <code>git</code> <code>commit</code> <code>--amend</code>.) |
Andrew Gerrand | 722f7d2 | 2014-12-18 11:42:25 +1100 | [diff] [blame] | 406 | </p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 407 | |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 408 | <h3>Mail the change for review</h3> |
| 409 | |
| 410 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 411 | Once the change is ready, mail it out for review: |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 412 | </p> |
| 413 | |
| 414 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 415 | $ git mail |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 416 | </pre> |
| 417 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 418 | <p> |
| 419 | You can specify a reviewer or CC interested parties |
| 420 | using the <code>-r</code> or <code>-cc</code> options. |
| 421 | Both accept a comma-separated list of email addresses: |
| 422 | </p> |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 423 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 424 | <pre> |
| 425 | $ git mail -r joe@golang.org -cc mabel@example.com,math-nuts@swtch.com |
| 426 | </pre> |
| 427 | |
| 428 | <p> |
| 429 | Unless explicitly told otherwise, such as in the discussion leading |
| 430 | up to sending in the change list, it's better not to specify a reviewer. |
| 431 | All changes are automatically CC'ed to the |
| 432 | <a href="https://groups.google.com/group/golang-codereviews">golang-codereviews@googlegroups.com</a> |
Josh Bleecher Snyder | 5ac5a98 | 2015-06-19 13:55:38 -0700 | [diff] [blame] | 433 | mailing list. If this is your first ever change, there may be a moderation |
| 434 | delay before it appears on the mailing list, to prevent spam. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 435 | </p> |
| 436 | |
| 437 | <p> |
| 438 | (In Git terms, <code>git</code> <code>mail</code> pushes the local committed |
| 439 | changes to Gerrit using <code>git</code> <code>push</code> <code>origin</code> |
| 440 | <code>HEAD:refs/for/master</code>.) |
| 441 | </p> |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 442 | |
| 443 | <p> |
| 444 | If your change relates to an open issue, please add a comment to the issue |
| 445 | announcing your proposed fix, including a link to your CL. |
| 446 | </p> |
| 447 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 448 | <p> |
| 449 | The code review server assigns your change an issue number and URL, |
| 450 | which <code>git</code> <code>mail</code> will print, something like: |
| 451 | </p> |
| 452 | |
| 453 | <pre> |
| 454 | remote: New Changes: |
| 455 | remote: https://go-review.googlesource.com/99999 math: improved Sin, Cos and Tan precision for very large arguments |
| 456 | </pre> |
| 457 | |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 458 | <h3>Reviewing code</h3> |
| 459 | |
| 460 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 461 | Running <code>git</code> <code>mail</code> will send an email to you and the |
| 462 | reviewers asking them to visit the issue's URL and make comments on the change. |
| 463 | When done, the reviewer adds comments through the Gerrit user interface |
| 464 | and clicks "Reply" to send comments back. |
| 465 | You will receive a mail notification when this happens. |
| 466 | You must reply through the web interface. |
| 467 | (Unlike with the old Rietveld review system, replying by mail has no effect.) |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 468 | </p> |
| 469 | |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 470 | <h3>Revise and upload</h3> |
| 471 | |
| 472 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 473 | You must respond to review comments through the web interface. |
| 474 | (Unlike with the old Rietveld review system, responding by mail has no effect.) |
| 475 | </p> |
| 476 | |
| 477 | <p> |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 478 | When you have revised the code and are ready for another round of review, |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 479 | stage those changes and use <code>git</code> <code>change</code> to update the |
| 480 | commit. |
| 481 | To send the update change list for another round of review, |
| 482 | run <code>git</code> <code>mail</code> again. |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 483 | </p> |
| 484 | |
| 485 | <p> |
| 486 | The reviewer can comment on the new copy, and the process repeats. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 487 | The reviewer approves the change by giving it a positive score |
| 488 | (+1 or +2) and replying <code>LGTM</code>: looks good to me. |
Bill Thiede | 822b2cb | 2014-07-03 17:42:23 -0400 | [diff] [blame] | 489 | </p> |
| 490 | |
| 491 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 492 | You can see a list of your pending changes by running <code>git</code> |
| 493 | <code>pending</code>, and switch between change branches with <code>git</code> |
| 494 | <code>change</code> <code><i><branch></i></code>. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 495 | </p> |
| 496 | |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 497 | <h3>Synchronize your client</h3> |
| 498 | |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 499 | <p> |
| 500 | While you were working, others might have submitted changes to the repository. |
| 501 | To update your local branch, run |
| 502 | </p> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 503 | |
| 504 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 505 | $ git sync |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 506 | </pre> |
| 507 | |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 508 | <p> |
Oling Cat | ce36552 | 2014-12-14 14:32:56 +0800 | [diff] [blame] | 509 | (In git terms, <code>git</code> <code>sync</code> runs |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 510 | <code>git</code> <code>pull</code> <code>-r</code>.) |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 511 | </p> |
| 512 | |
| 513 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 514 | If files you were editing have changed, Git does its best to merge the |
| 515 | remote changes into your local changes. |
| 516 | It may leave some files to merge by hand. |
| 517 | </p> |
| 518 | |
| 519 | <p> |
| 520 | For example, suppose you have edited <code>sin.go</code> but |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 521 | someone else has committed an independent change. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 522 | When you run <code>git</code> <code>sync</code>, |
| 523 | you will get the (scary-looking) output: |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 524 | |
| 525 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 526 | $ git sync |
| 527 | Failed to merge in the changes. |
| 528 | Patch failed at 0023 math: improved Sin, Cos and Tan precision for very large arguments |
| 529 | The copy of the patch that failed is found in: |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 530 | /home/you/repo/.git/rebase-apply/patch |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 531 | |
| 532 | When you have resolved this problem, run "git rebase --continue". |
| 533 | If you prefer to skip this patch, run "git rebase --skip" instead. |
| 534 | To check out the original branch and stop rebasing, run "git rebase --abort". |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 535 | </pre> |
| 536 | |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 537 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 538 | If this happens, run |
| 539 | </p> |
| 540 | |
| 541 | <pre> |
| 542 | $ git status |
| 543 | </pre> |
| 544 | |
| 545 | <p> |
| 546 | to see which files failed to merge. |
| 547 | The output will look something like this: |
| 548 | </p> |
| 549 | |
| 550 | <pre> |
| 551 | rebase in progress; onto a24c3eb |
| 552 | You are currently rebasing branch 'mcgillicutty' on 'a24c3eb'. |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 553 | (fix conflicts and then run "git rebase --continue") |
| 554 | (use "git rebase --skip" to skip this patch) |
| 555 | (use "git rebase --abort" to check out the original branch) |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 556 | |
| 557 | Unmerged paths: |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 558 | (use "git reset HEAD <file>..." to unstage) |
| 559 | (use "git add <file>..." to mark resolution) |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 560 | |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 561 | <i>both modified: sin.go</i> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 562 | </pre> |
| 563 | |
| 564 | <p> |
| 565 | The only important part in that transcript is the italicized "both modified" |
| 566 | line: Git failed to merge your changes with the conflicting change. |
| 567 | When this happens, Git leaves both sets of edits in the file, |
| 568 | with conflicts marked by <code><<<<<<<</code> and |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 569 | <code>>>>>>>></code>. |
Tetsuo Kiso | 48347cc | 2014-07-07 16:31:20 +1000 | [diff] [blame] | 570 | It is now your job to edit the file to combine them. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 571 | Continuing the example, searching for those strings in <code>sin.go</code> |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 572 | might turn up: |
| 573 | </p> |
| 574 | |
| 575 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 576 | arg = scale(arg) |
| 577 | <<<<<<< HEAD |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 578 | if arg < 1e9 { |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 579 | ======= |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 580 | if arg &lh; 1e10 { |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 581 | >>>>>>> mcgillicutty |
| 582 | largeReduce(arg) |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 583 | </pre> |
| 584 | |
| 585 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 586 | Git doesn't show it, but suppose the original text that both edits |
| 587 | started with was 1e8; you changed it to 1e10 and the other change to 1e9, |
| 588 | so the correct answer might now be 1e10. First, edit the section |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 589 | to remove the markers and leave the correct code: |
| 590 | </p> |
| 591 | |
| 592 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 593 | arg = scale(arg) |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 594 | if arg < 1e10 { |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 595 | largeReduce(arg) |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 596 | </pre> |
| 597 | |
| 598 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 599 | Then tell Git that the conflict is resolved by running |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 600 | </p> |
| 601 | |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 602 | <pre> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 603 | $ git add sin.go |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 604 | </pre> |
| 605 | |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 606 | <p> |
Russ Cox | 830813f | 2009-11-08 21:08:27 -0800 | [diff] [blame] | 607 | If you had been editing the file, say for debugging, but do not |
| 608 | care to preserve your changes, you can run |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 609 | <code>git</code> <code>reset</code> <code>HEAD</code> <code>sin.go</code> |
| 610 | to abandon your changes. |
| 611 | Then run <code>git</code> <code>rebase</code> <code>--continue</code> to |
| 612 | restore the change commit. |
Russ Cox | 696e802 | 2009-11-07 18:56:00 -0800 | [diff] [blame] | 613 | </p> |
| 614 | |
Dave Cheney | eda9590 | 2013-02-10 19:40:33 -0500 | [diff] [blame] | 615 | <h3>Reviewing code by others</h3> |
| 616 | |
| 617 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 618 | You can import a change proposed by someone else into your local Git repository. |
| 619 | On the Gerrit review page, click the "Download ▼" link in the upper right |
| 620 | corner, copy the "Checkout" command and run it from your local Git repo. |
| 621 | It should look something like this: |
Dave Cheney | eda9590 | 2013-02-10 19:40:33 -0500 | [diff] [blame] | 622 | </p> |
| 623 | |
| 624 | <pre> |
Lloyd Dewolf | fbbf219 | 2015-02-24 21:33:29 -0800 | [diff] [blame] | 625 | $ git fetch https://go.googlesource.com/review refs/changes/21/1221/1 && git checkout FETCH_HEAD |
Dave Cheney | eda9590 | 2013-02-10 19:40:33 -0500 | [diff] [blame] | 626 | </pre> |
| 627 | |
| 628 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 629 | To revert, change back to the branch you were working in. |
Oling Cat | aecbcd0 | 2013-02-15 14:01:12 +1100 | [diff] [blame] | 630 | </p> |
Dave Cheney | eda9590 | 2013-02-10 19:40:33 -0500 | [diff] [blame] | 631 | |
Russ Cox | 5facb84 | 2009-12-09 14:39:41 -0800 | [diff] [blame] | 632 | <h3>Submit the change after the review</h3> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 633 | |
| 634 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 635 | After the code has been <code>LGTM</code>'ed, an approver may |
| 636 | submit it to the master branch using the Gerrit UI. |
| 637 | There is a "Submit" button on the web page for the change |
| 638 | that appears once the change is approved (marked +2). |
Dave Cheney | eda9590 | 2013-02-10 19:40:33 -0500 | [diff] [blame] | 639 | </p> |
| 640 | |
| 641 | <p> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 642 | This checks the change into the repository. |
| 643 | The change description will include a link to the code review, |
| 644 | and the code review will be updated with a link to the change |
| 645 | in the repository. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 646 | Since the method used to integrate the changes is "Cherry Pick", |
| 647 | the commit hashes in the repository will be changed by |
| 648 | the submit operation. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 649 | </p> |
| 650 | |
Robert Hencke | 75ba181 | 2014-04-25 20:09:04 -0700 | [diff] [blame] | 651 | <h3>More information</h3> |
| 652 | |
| 653 | <p> |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 654 | In addition to the information here, the Go community maintains a <a href="https://golang.org/wiki/CodeReview">CodeReview</a> wiki page. |
Robert Hencke | 75ba181 | 2014-04-25 20:09:04 -0700 | [diff] [blame] | 655 | Feel free to contribute to this page as you learn the review process. |
| 656 | </p> |
| 657 | |
Dave Cheney | eda9590 | 2013-02-10 19:40:33 -0500 | [diff] [blame] | 658 | <h2 id="copyright">Copyright</h2> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 659 | |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 660 | <p>Files in the Go repository don't list author names, |
| 661 | both to avoid clutter and to avoid having to keep the lists up to date. |
Andrew Gerrand | d708e92 | 2014-12-10 09:29:35 +1100 | [diff] [blame] | 662 | Instead, your name will appear in the |
| 663 | <a href="https://golang.org/change">change log</a> |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 664 | and in the <a href="/CONTRIBUTORS"><code>CONTRIBUTORS</code></a> file |
| 665 | and perhaps the <a href="/AUTHORS"><code>AUTHORS</code></a> file. |
| 666 | </p> |
| 667 | |
| 668 | <p>The <a href="/CONTRIBUTORS"><code>CONTRIBUTORS</code></a> file |
| 669 | defines who the Go contributors—the people—are; |
Caleb Spare | 41f32e0 | 2013-01-06 22:44:16 -0500 | [diff] [blame] | 670 | the <a href="/AUTHORS"><code>AUTHORS</code></a> file defines |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 671 | who “The Go Authors”—the copyright holders—are. |
Dmitry Savintsev | 30ab39a | 2015-06-09 12:01:38 +0200 | [diff] [blame] | 672 | These files will be periodically updated based on the commit logs. |
| 673 | |
Russ Cox | d55abfd | 2009-12-09 14:05:12 -0800 | [diff] [blame] | 674 | <p>Code that you contribute should use the standard copyright header:</p> |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 675 | |
| 676 | <pre> |
David Symonds | 6cb4033 | 2015-01-01 00:00:00 +1100 | [diff] [blame] | 677 | // Copyright 2015 The Go Authors. All rights reserved. |
Russ Cox | 38a41ee | 2009-11-06 10:04:22 -0800 | [diff] [blame] | 678 | // Use of this source code is governed by a BSD-style |
| 679 | // license that can be found in the LICENSE file. |
| 680 | </pre> |
Dave Cheney | eda9590 | 2013-02-10 19:40:33 -0500 | [diff] [blame] | 681 | |
| 682 | <p> |
| 683 | Files in the repository are copyright the year they are added. It is not |
| 684 | necessary to update the copyright year on files that you change. |
| 685 | </p> |