Edwin Kempin | 1f55622 | 2015-04-22 13:24:39 +0200 | [diff] [blame] | 1 | = User Guide |
| 2 | |
| 3 | This is a Gerrit guide that is dedicated to Gerrit end-users. It |
| 4 | explains the standard Gerrit workflows and how a user can adapt Gerrit |
| 5 | to personal preferences. |
| 6 | |
| 7 | It is expected that readers know about link:http://git-scm.com/[Git] |
| 8 | and that they are familiar with basic git commands and workflows. |
| 9 | |
| 10 | [[gerrit]] |
| 11 | == What is Gerrit? |
| 12 | |
| 13 | Gerrit is a Git server that provides link:access-control.html[access |
| 14 | control] for the hosted Git repositories and a web front-end for doing |
| 15 | link:#code-review[code review]. Code review is a core functionality of |
| 16 | Gerrit, but still it is optional and teams can decide to |
| 17 | link:#no-code-review[work without code review]. |
| 18 | |
| 19 | [[tools]] |
| 20 | == Tools |
| 21 | |
| 22 | Gerrit speaks the git protocol. This means in order to work with Gerrit |
| 23 | you do *not* need to install any Gerrit client, but having a regular |
| 24 | git client, such as the link:http://git-scm.com/[git command line] or |
| 25 | link:http://eclipse.org/egit/[EGit] in Eclipse, is sufficient. |
| 26 | |
| 27 | Still there are some client-side tools for Gerrit, which can be used |
| 28 | optionally: |
| 29 | |
| 30 | * link:http://eclipse.org/mylyn/[Mylyn Gerrit Connector]: Gerrit |
| 31 | integration with Mylyn |
Edwin Kempin | 4cb451e | 2015-05-08 09:07:51 +0200 | [diff] [blame] | 32 | * link:https://github.com/uwolfer/gerrit-intellij-plugin[Gerrit |
| 33 | IntelliJ Plugin]: Gerrit integration with the |
| 34 | link:http://www.jetbrains.com/idea/[IntelliJ Platform] |
Edwin Kempin | 1f55622 | 2015-04-22 13:24:39 +0200 | [diff] [blame] | 35 | * link:https://play.google.com/store/apps/details?id=com.jbirdvegas.mgerrit[ |
| 36 | mGerrit]: Android client for Gerrit |
| 37 | * link:https://github.com/stackforge/gertty[Gertty]: Console-based |
| 38 | interface for Gerrit |
| 39 | |
| 40 | [[clone]] |
| 41 | == Clone Gerrit Project |
| 42 | |
| 43 | Cloning a Gerrit project is done the same way as cloning any other git |
| 44 | repository by using the `git clone` command. |
| 45 | |
| 46 | .Clone Gerrit Project |
| 47 | ---- |
| 48 | $ git clone ssh://gerrithost:29418/RecipeBook.git RecipeBook |
| 49 | Cloning into RecipeBook... |
| 50 | ---- |
| 51 | |
| 52 | The URL for cloning the project can be found in the Gerrit web UI |
| 53 | under `Projects` > `List` > <project-name> > `General`. |
| 54 | |
| 55 | For git operations Gerrit supports the link:user-upload.html#ssh[SSH] |
| 56 | and the link:user-upload.html#http[HTTP/HTTPS] protocols. |
| 57 | |
| 58 | [NOTE] |
| 59 | To use SSH you must link:user-upload.html#configure_ssh[generate an SSH |
| 60 | key pair and upload the public SSH key to Gerrit]. |
| 61 | |
| 62 | [[code-review]] |
| 63 | == Code Review Workflow |
| 64 | |
| 65 | With Gerrit _Code Review_ means to link:#review-change[review] every |
| 66 | commit *before* it is accepted into the code base. The author of a code |
| 67 | modification link:user-upload.html#push_create[uploads a commit] as a |
| 68 | change to Gerrit. In Gerrit each change is stored in a |
| 69 | link:#change-ref[staging area] where it can be checked and reviewed. |
| 70 | Only when it is approved and submitted it gets applied to the code |
| 71 | base. If there is feedback on a change, the author can improve the code |
| 72 | modification by link:#upload-patch-set[amending the commit and |
| 73 | uploading the new commit as a new patch set]. This way a change is |
| 74 | improved iteratively and it is applied to the code base only when is |
| 75 | ready. |
| 76 | |
| 77 | [[upload-change]] |
| 78 | == Upload a Change |
| 79 | |
| 80 | Uploading a change to Gerrit is done by pushing a commit to Gerrit. The |
| 81 | commit must be pushed to a ref in the `refs/for/` namespace which |
| 82 | defines the target branch: `refs/for/<target-branch>`. |
| 83 | The magic `refs/for/` prefix allows Gerrit to differentiate commits |
| 84 | that are pushed for review from commits that are pushed directly into |
| 85 | the repository, bypassing code review. For the target branch it is |
| 86 | sufficient to specify the short name, e.g. `master`, but you can also |
| 87 | specify the fully qualified branch name, e.g. `refs/heads/master`. |
| 88 | |
| 89 | .Push for Code Review |
| 90 | ---- |
| 91 | $ git commit |
| 92 | $ git push origin HEAD:refs/for/master |
| 93 | |
| 94 | // this is the same as: |
| 95 | $ git commit |
| 96 | $ git push origin HEAD:refs/for/refs/heads/master |
| 97 | ---- |
| 98 | |
| 99 | .Push with bypassing Code Review |
| 100 | ---- |
| 101 | $ git commit |
| 102 | $ git push origin HEAD:master |
| 103 | |
| 104 | // this is the same as: |
| 105 | $ git commit |
| 106 | $ git push origin HEAD:refs/heads/master |
| 107 | ---- |
| 108 | |
| 109 | [[push-fails]] |
| 110 | [NOTE] |
| 111 | If pushing to Gerrit fails consult the Gerrit documentation that |
| 112 | explains the link:error-messages.html[error messages]. |
| 113 | |
| 114 | [[change-ref]] |
| 115 | When a commit is pushed for review, Gerrit stores it in a staging area |
| 116 | which is a branch in the special `refs/changes/` namespace. A change |
| 117 | ref has the format `refs/changes/XX/YYYY/ZZ` where `YYYY` is the |
| 118 | numeric change number, `ZZ` is the patch set number and `XX` is the |
| 119 | last two digits of the numeric change number, e.g. |
| 120 | `refs/changes/20/884120/1`. Understanding the format of this ref is not |
| 121 | required for working with Gerrit. |
| 122 | |
| 123 | [[fetch-change]] |
| 124 | Using the change ref git clients can fetch the corresponding commit, |
| 125 | e.g. for local verification. |
| 126 | |
| 127 | .Fetch Change |
| 128 | ---- |
| 129 | $ git fetch https://gerrithost/myProject refs/changes/74/67374/2 && git checkout FETCH_HEAD |
| 130 | ---- |
| 131 | |
| 132 | [NOTE] |
| 133 | The fetch command can be copied from the |
| 134 | link:user-review-ui.html#download[download commands] in the change |
| 135 | screen. |
| 136 | |
| 137 | The `refs/for/` prefix is used to map the Gerrit concept of |
| 138 | "Pushing for Review" to the git protocol. For the git client it looks |
| 139 | like every push goes to the same branch, e.g. `refs/for/master` but in |
| 140 | fact for each commit that is pushed to this ref Gerrit creates a new |
| 141 | branch under the `refs/changes/` namespace. In addition Gerrit creates |
| 142 | an open change. |
| 143 | |
| 144 | [[change]] |
| 145 | A change consists of a link:user-changeid.html[Change-Id], meta data |
| 146 | (owner, project, target branch etc.), one or more patch sets, comments |
| 147 | and votes. A patch set is a git commit. Each patch set in a change |
| 148 | represents a new version of the change and replaces the previous patch |
| 149 | set. Only the latest patch set is relevant. This means all failed |
| 150 | iterations of a change will never be applied to the target branch, but |
| 151 | only the last patch set that is approved is integrated. |
| 152 | |
| 153 | [[change-id]] |
| 154 | The Change-Id is important for Gerrit to know whether a commit that is |
| 155 | pushed for code review should create a new change or whether it should |
| 156 | create a new patch set for an existing change. |
| 157 | |
| 158 | The Change-Id is a SHA-1 that is prefixed with an uppercase `I`. It is |
| 159 | specified as footer in the commit message (last paragraph): |
| 160 | |
| 161 | ---- |
| 162 | Improve foo widget by attaching a bar. |
| 163 | |
| 164 | We want a bar, because it improves the foo by providing more |
| 165 | wizbangery to the dowhatimeanery. |
| 166 | |
| 167 | Bug: #42 |
| 168 | Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5b |
| 169 | Signed-off-by: A. U. Thor <author@example.com> |
| 170 | ---- |
| 171 | |
| 172 | If a commit that has a Change-Id in its commit message is pushed for |
| 173 | review, Gerrit checks if a change with this Change-Id already exists |
| 174 | for this project and target branch, and if yes, Gerrit creates a new |
| 175 | patch set for this change. If not, a new change with the given |
| 176 | Change-Id is created. |
| 177 | |
| 178 | If a commit without Change-Id is pushed for review, Gerrit creates a |
| 179 | new change and generates a Change-Id for it. Since in this case the |
| 180 | Change-Id is not included in the commit message, it must be manually |
| 181 | inserted when a new patch set should be uploaded. Most projects already |
| 182 | link:project-configuration.html#require-change-id[require a Change-Id] |
| 183 | when pushing the very first patch set. This reduces the risk of |
| 184 | accidentally creating a new change instead of uploading a new patch |
| 185 | set. Any push without Change-Id then fails with |
| 186 | link:error-missing-changeid.html[missing Change-Id in commit message |
| 187 | footer]. New patch sets can always be uploaded to a specific change |
| 188 | (even without any Change-Id) by pushing to the change ref, e.g. |
| 189 | `refs/changes/74/67374`. |
| 190 | |
| 191 | Amending and rebasing a commit preserves the Change-Id so that the new |
| 192 | commit automatically becomes a new patch set of the existing change, |
| 193 | when it is pushed for review. |
| 194 | |
| 195 | .Push new Patch Set |
| 196 | ---- |
| 197 | $ git commit --amend |
| 198 | $ git push origin HEAD:refs/for/master |
| 199 | ---- |
| 200 | |
| 201 | Change-Ids are unique for a branch of a project. E.g. commits that fix |
| 202 | the same issue in different branches should have the same Change-Id, |
| 203 | which happens automatically if a commit is cherry-picked to another |
| 204 | branch. This way you can link:user-search.html[search] by the Change-Id |
| 205 | in the Gerrit web UI to find a fix in all branches. |
| 206 | |
| 207 | Change-Ids can be created automatically by installing the `commit-msg` |
| 208 | hook as described in the link:user-changeid.html#creation[Change-Id |
| 209 | documentation]. |
| 210 | |
| 211 | Instead of manually installing the `commit-msg` hook for each git |
| 212 | repository, you can copy it into the |
| 213 | link:http://git-scm.com/docs/git-init#_template_directory[git template |
| 214 | directory]. Then it is automatically copied to every newly cloned |
| 215 | repository. |
| 216 | |
| 217 | [[review-change]] |
| 218 | == Review Change |
| 219 | |
| 220 | After link:#upload-change[uploading a change for review] reviewers can |
| 221 | inspect it via the Gerrit web UI. Reviewers can see the code delta and |
| 222 | link:user-review-ui.html#inline-comments[comment directly in the code] |
| 223 | on code blocks or lines. They can also link:user-review-ui.html#reply[ |
| 224 | post summary comments and vote on review labels]. The |
| 225 | link:user-review-ui.html[documentation of the review UI] explains the |
| 226 | screens and controls for doing code reviews. |
| 227 | |
| 228 | There are several options to control how patch diffs should be |
| 229 | rendered. Users can configure their preferences in the |
| 230 | link:user-review-ui.html#diff-preferences[diff preferences]. |
| 231 | |
| 232 | [[upload-patch-set]] |
| 233 | == Upload a new Patch Set |
| 234 | |
| 235 | If there is feedback from code review and a change should be improved a |
| 236 | new patch set with the reworked code should be uploaded. |
| 237 | |
| 238 | This is done by amending the commit of the last patch set. If needed |
| 239 | this commit can be fetched from Gerrit by using the fetch command from |
| 240 | the link:user-review-ui.html#download[download commands] in the change |
| 241 | screen. |
| 242 | |
| 243 | It is important that the commit message contains the |
| 244 | link:user-changeid.html[Change-Id] of the change that should be updated |
| 245 | as a footer (last paragraph). Normally the commit message already |
| 246 | contains the correct Change-Id and the Change-Id is preserved when the |
| 247 | commit is amended. |
| 248 | |
| 249 | .Push Patch Set |
| 250 | ---- |
| 251 | // fetch and checkout the change |
| 252 | // (checkout command copied from change screen) |
| 253 | $ git fetch https://gerrithost/myProject refs/changes/74/67374/2 && git checkout FETCH_HEAD |
| 254 | |
| 255 | // rework the change |
| 256 | $ git add <path-of-reworked-file> |
| 257 | ... |
| 258 | |
| 259 | // amend commit |
| 260 | $ git commit --amend |
| 261 | |
| 262 | // push patch set |
| 263 | $ git push origin HEAD:refs/for/master |
| 264 | ---- |
| 265 | |
| 266 | [NOTE] |
| 267 | Never amend a commit that is already part of a central branch. |
| 268 | |
| 269 | Pushing a new patch set triggers email notification to the reviewers. |
| 270 | |
| 271 | [[multiple-features]] |
| 272 | == Developing multiple Features in parallel |
| 273 | |
| 274 | Code review takes time, which can be used by the change author to |
| 275 | implement other features. Each feature should be implemented in its own |
| 276 | local feature branch that is based on the current HEAD of the target |
| 277 | branch. This way there is no dependency to open changes and new |
| 278 | features can be reviewed and applied independently. If wanted, it is |
| 279 | also possible to base a new feature on an open change. This will create |
| 280 | a dependency between the changes in Gerrit and each change can only be |
| 281 | applied if all its predecessor are applied as well. Dependencies |
| 282 | between changes can be seen from the |
| 283 | link:user-review-ui.html#related-changes-tab[Related Changes] tab on |
| 284 | the change screen. |
| 285 | |
| 286 | [[watch]] |
| 287 | == Watching Projects |
| 288 | |
| 289 | To get to know about new changes you can link:user-notify.html#user[ |
| 290 | watch the projects] that you are interested in. For watched projects |
| 291 | Gerrit sends you email notifications when a change is uploaded or |
| 292 | modified. You can decide on which events you want to be notified and |
| 293 | you can filter the notifications by using link:user-search.html[change |
| 294 | search expressions]. For example '+branch:master file:^.*\.txt$+' would |
| 295 | send you email notifications only for changes in the master branch that |
| 296 | touch a 'txt' file. |
| 297 | |
| 298 | It is common that the members of a project team watch their own |
| 299 | projects and then pick the changes that are interesting to them for |
| 300 | review. |
| 301 | |
| 302 | Project owners may also configure |
| 303 | link:intro-project-owner.html#notifications[notifications on |
| 304 | project-level]. |
| 305 | |
| 306 | [[adding-reviewers]] |
| 307 | == Adding Reviewers |
| 308 | |
| 309 | In the link:user-review-ui.html#reviewers[change screen] reviewers can |
| 310 | be added explicitly to a change. The added reviewer will then be |
| 311 | notified by email about the review request. |
| 312 | |
| 313 | Mainly this functionality is used to request the review of specific |
| 314 | person who is known to be an expert in the modified code or who is a |
| 315 | stakeholder of the implemented feature. Normally it is not needed to |
| 316 | explicitly add reviewers on every change, but you rather rely on the |
| 317 | project team to watch their project and to process the incoming changes |
| 318 | by importance, interest, time etc. |
| 319 | |
| 320 | There are also link:intro-project-owner.html#reviewers[plugins which |
| 321 | can add reviewers automatically] (e.g. by configuration or based on git |
| 322 | blame annotations). If this functionality is required it should be |
| 323 | discussed with the project owners and the Gerrit administrators. |
| 324 | |
| 325 | [[dashboards]] |
| 326 | == Dashboards |
| 327 | |
| 328 | Gerrit supports a wide range of link:user-search.html#search-operators[ |
| 329 | query operators] to search for changes by different criteria, e.g. by |
| 330 | status, change owner, votes etc. |
| 331 | |
| 332 | The page that shows the results of a change query has the change query |
| 333 | contained in its URL. This means you can bookmark this URL in your |
| 334 | browser to save the change query. This way it can be easily re-executed |
| 335 | later. |
| 336 | |
| 337 | Several change queries can be also combined into a dashboard. A |
| 338 | dashboard is a screen in Gerrit that presents the results of several |
| 339 | change queries in different sections, each section having a descriptive |
| 340 | title. |
| 341 | |
| 342 | A default dashboard is available under `My` > `Changes`. It has |
| 343 | sections to list outgoing reviews, incoming reviews and recently closed |
| 344 | changes. |
| 345 | |
| 346 | Users can also define link:user-dashboards.html#custom-dashboards[ |
| 347 | custom dashboards]. Dashboards can be bookmarked in a browser so that |
| 348 | they can be re-executed later. |
| 349 | |
| 350 | It is also possible to link:#my-menu[customize the My menu] and add |
| 351 | menu entries for custom queries or dashboards to it. |
| 352 | |
| 353 | Dashboards are very useful to define own views on changes, e.g. you can |
| 354 | have different dashboards for own contributions, for doing reviews or |
| 355 | for different sets of projects. |
| 356 | |
| 357 | [NOTE] |
| 358 | You can use the link:user-search.html#limit[limit] and |
| 359 | link:user-search.html#age[age] query operators to limit the result set |
| 360 | in a dashboard section. Clicking on the section title executes the |
| 361 | change query without the `limit` and `age` operator so that you can |
| 362 | inspect the full result set. |
| 363 | |
| 364 | Project owners can also define shared |
| 365 | link:user-dashboards.html#project-dashboards[dashboards on |
| 366 | project-level]. The project dashboards can be seen in the web UI under |
| 367 | `Projects` > `List` > <project-name> > `Dashboards`. |
| 368 | |
| 369 | [[submit]] |
| 370 | == Submit a Change |
| 371 | |
| 372 | Submitting a change means that the code modifications of the current |
| 373 | patch set are applied to the target branch. Submit requires the |
| 374 | link:access-control.html#category_submit[Submit] access right and is |
| 375 | done on the change screen by clicking on the |
| 376 | link:user-review-ui.html#submit[Submit] button. |
| 377 | |
| 378 | In order to be submittable changes must first be approved by |
| 379 | link:user-review-ui.html#vote[voting on the review labels]. By default |
| 380 | a change can only be submitted if it has a vote with the highest value |
| 381 | on each review label and no vote with the lowest value (veto vote). |
| 382 | Projects can configure link:intro-project-owner.html#labels[custom |
| 383 | labels] and link:intro-project-owner.html#submit-rules[custom submit |
| 384 | rules] to control when a change becomes submittable. |
| 385 | |
| 386 | How the code modification is applied to the target branch when a change |
| 387 | is submitted is controlled by the |
| 388 | link:project-configuration.html#submit_type[submit type] which can be |
| 389 | link:intro-project-owner.html#submit-type[configured on project-level]. |
| 390 | |
| 391 | Submitting a change may fail with conflicts. In this case you need to |
| 392 | link:#rebase[rebase] the change locally, resolve the conflicts and |
| 393 | upload the commit with the conflict resolution as new patch set. |
| 394 | |
| 395 | If a change cannot be merged due to path conflicts this is highlighted |
| 396 | on the change screen by a bold red `Cannot Merge` label. |
| 397 | |
| 398 | [[rebase]] |
| 399 | == Rebase a Change |
| 400 | |
| 401 | While a change is in review the HEAD of the target branch can evolve. |
| 402 | In this case the change can be rebased onto the new HEAD of the target |
| 403 | branch. When there are no conflicts the rebase can be done directly |
| 404 | from the link:user-review-ui.html#rebase[change screen], otherwise it |
| 405 | must be done locally. |
| 406 | |
| 407 | .Rebase a Change locally |
| 408 | ---- |
| 409 | // update the remote tracking branches |
| 410 | $ git fetch |
| 411 | |
| 412 | // fetch and checkout the change |
| 413 | // (checkout command copied from change screen) |
| 414 | $ git fetch https://gerrithost/myProject refs/changes/74/67374/2 && git checkout FETCH_HEAD |
| 415 | |
| 416 | // do the rebase |
| 417 | $ git rebase origin/master |
| 418 | |
| 419 | // resolve conflicts if needed and stage the conflict resolution |
| 420 | ... |
| 421 | $ git add <path-of-file-with-conflicts-resolved> |
| 422 | |
| 423 | // continue the rebase |
| 424 | $ git rebase --continue |
| 425 | |
| 426 | // push the commit with the conflict resolution as new patch set |
| 427 | $ git push origin HEAD:refs/for/master |
| 428 | ---- |
| 429 | |
| 430 | Doing a manual rebase is only necessary when there are conflicts that |
| 431 | cannot be resolved by Gerrit. If manual conflict resolution is needed |
| 432 | also depends on the link:intro-project-owner.html#submit-type[submit |
| 433 | type] that is configured for the project. |
| 434 | |
| 435 | Generally changes shouldn't be rebased without reason as it |
| 436 | increases the number of patch sets and creates noise with |
| 437 | notifications. However if a change is in review for a long time it may |
| 438 | make sense to rebase it from time to time, so that reviewers can see |
| 439 | the delta against the current HEAD of the target branch. It also shows |
| 440 | that there is still an interest in this change. |
| 441 | |
| 442 | [NOTE] |
| 443 | Never rebase commits that are already part of a central branch. |
| 444 | |
| 445 | [[abandon]] |
| 446 | [[restore]] |
| 447 | == Abandon/Restore a Change |
| 448 | |
| 449 | Sometimes during code review a change is found to be bad and it should |
| 450 | be given up. In this case the change can be |
| 451 | link:user-review-ui.html#abandon[abandoned] so that it doesn't appear |
| 452 | in list of open changes anymore. |
| 453 | |
| 454 | Abandoned changes can be link:user-review-ui.html#restore[restored] if |
| 455 | later they are needed again. |
| 456 | |
| 457 | [[topics]] |
| 458 | == Using Topics |
| 459 | |
| 460 | Changes can be grouped by topics. This is useful because it allows you |
| 461 | to easily find related changes by using the |
| 462 | link:user-search.html#topic[topic search operator]. Also on the change |
| 463 | screen link:user-review-ui.html#same-topic[changes with the same topic] |
| 464 | are displayed so that you can easily navigate between them. |
| 465 | |
| 466 | Often changes that together implement a feature or a user story are |
| 467 | group by a topic. |
| 468 | |
| 469 | Assigning a topic to a change can be done in the |
| 470 | link:user-review-ui.html#project-branch-topic[change screen]. |
| 471 | |
| 472 | It is also possible to link:user-upload.html#topic[set a topic on |
Dan Wang | 17ced40 | 2016-08-26 16:42:49 -0700 | [diff] [blame] | 473 | push], either by appending `%topic=...` to the ref name or through |
| 474 | the use of the command line flag `--push-option`, aliased to `-o`, |
| 475 | followed by `topic=...`. |
Edwin Kempin | 1f55622 | 2015-04-22 13:24:39 +0200 | [diff] [blame] | 476 | |
| 477 | .Set Topic on Push |
| 478 | ---- |
| 479 | $ git push origin HEAD:refs/for/master%topic=multi-master |
Dan Wang | 17ced40 | 2016-08-26 16:42:49 -0700 | [diff] [blame] | 480 | |
| 481 | // this is the same as: |
| 482 | $ git push origin HEAD:refs/heads/master -o topic=multi-master |
Edwin Kempin | 1f55622 | 2015-04-22 13:24:39 +0200 | [diff] [blame] | 483 | ---- |
| 484 | |
| 485 | [[drafts]] |
| 486 | == Working with Drafts |
| 487 | |
| 488 | Changes can be uploaded as drafts. By default draft changes are only |
| 489 | visible to the change owner. This gives you the possibility to have |
| 490 | some staging before making your changes visible to the reviewers. Draft |
| 491 | changes can also be used to backup unfinished changes. |
| 492 | |
| 493 | A draft change is created by pushing to the magic |
| 494 | `refs/drafts/<target-branch>` ref. |
| 495 | |
| 496 | .Push a Draft Change |
| 497 | ---- |
| 498 | $ git commit |
| 499 | $ git push origin HEAD:refs/drafts/master |
| 500 | ---- |
| 501 | |
| 502 | Draft changes have the state link:user-review-ui.html#draft[Draft] and |
| 503 | can be link:user-review-ui.html#publish[published] or |
| 504 | link:user-review-ui.html#delete[deleted] from the change screen. |
| 505 | |
| 506 | By link:user-review-ui.html#reviewers[adding reviewers] to a draft |
| 507 | change the change is made visible to these users. This way you can |
| 508 | collaborate with other users in privacy. |
| 509 | |
| 510 | By pushing to `refs/drafts/<target-branch>` you can also upload draft |
| 511 | patch sets to non-draft changes. Draft patch sets are immediately |
| 512 | visible to all reviewers of the change, but other users cannot see the |
| 513 | draft patch set. A draft patch set can be published and deleted in the |
| 514 | same way as a draft change. |
| 515 | |
| 516 | [[inline-edit]] |
| 517 | == Inline Edit |
| 518 | |
| 519 | It is possible to link:user-inline-edit.html#editing-change[edit |
| 520 | changes inline] directly in the web UI. This is useful to make small |
| 521 | corrections immediately and publish them as a new patch set. |
| 522 | |
| 523 | It is also possible to link:user-inline-edit.html#create-change[create |
| 524 | new changes inline]. |
| 525 | |
| 526 | [[project-administration]] |
| 527 | == Project Administration |
| 528 | |
| 529 | Every project has a link:intro-project-owner.html#project-owner[project |
| 530 | owner] that administrates the project. Project administration includes |
| 531 | the configuration of the project |
| 532 | link:intro-project-owner.html#access-rights[access rights], but project |
| 533 | owners have many more possibilities to customize the workflows for a |
| 534 | project which are described in the link:intro-project-owner.html[ |
| 535 | project owner guide]. |
| 536 | |
| 537 | [[no-code-review]] |
| 538 | == Working without Code Review |
| 539 | |
| 540 | Doing code reviews with Gerrit is optional and you can use Gerrit |
| 541 | without code review as a pure Git server. |
| 542 | |
| 543 | .Push with bypassing Code Review |
| 544 | ---- |
| 545 | $ git commit |
| 546 | $ git push origin HEAD:master |
| 547 | |
| 548 | // this is the same as: |
| 549 | $ git commit |
| 550 | $ git push origin HEAD:refs/heads/master |
| 551 | ---- |
| 552 | |
| 553 | [NOTE] |
| 554 | Bypassing code review must be enabled in the project access rights. The |
| 555 | project owner must allow it by assigning the |
| 556 | link:access-control.html#category_push_direct[Push] access right on the |
| 557 | target branch (`refs/heads/<branch-name>`). |
| 558 | |
| 559 | [NOTE] |
| 560 | If you bypass code review you always need to merge/rebase manually if |
| 561 | the tip of the destination branch has moved. Please keep this in mind |
| 562 | if you choose to not work with code review because you think it's |
| 563 | easier to avoid the additional complexity of the review workflow; it |
| 564 | might actually not be easier. |
| 565 | |
| 566 | [NOTE] |
| 567 | The project owner may enable link:user-upload.html#auto_merge[ |
| 568 | auto-merge on push] to benefit from the automatic merge/rebase on |
| 569 | server side while pushing directly into the repository. |
| 570 | |
Martin Fick | 21c557b | 2015-08-31 16:03:24 -0600 | [diff] [blame] | 571 | [[user-refs]] |
| 572 | == User Refs |
| 573 | |
| 574 | User configuration data such as link:#preferences[preferences] is |
| 575 | stored in the `All-Users` project under a per-user ref. The user's |
| 576 | ref is based on the user's account id which is an integer. The user |
| 577 | refs are sharded by the last two digits (`+nn+`) in the refname, |
| 578 | leading to refs of the format `+refs/users/nn/accountid+`. |
| 579 | |
Edwin Kempin | 1f55622 | 2015-04-22 13:24:39 +0200 | [diff] [blame] | 580 | [[preferences]] |
| 581 | == Preferences |
| 582 | |
| 583 | There are several options to control the rendering in the Gerrit web UI. |
| 584 | Users can configure their preferences under `Settings` > `Preferences`. |
Martin Fick | 21c557b | 2015-08-31 16:03:24 -0600 | [diff] [blame] | 585 | The user's preferences are stored in a `git config` style file named |
| 586 | `preferences.config` under the link:#user-refs[user's ref] in the |
| 587 | `All-Users` project. |
Edwin Kempin | 1f55622 | 2015-04-22 13:24:39 +0200 | [diff] [blame] | 588 | |
| 589 | The following preferences can be configured: |
| 590 | |
Edwin Kempin | 1f55622 | 2015-04-22 13:24:39 +0200 | [diff] [blame] | 591 | - [[review-category]]`Display In Review Category`: |
| 592 | + |
| 593 | This setting controls how the values of the review labels in change |
| 594 | lists and dashboards are visualized. |
| 595 | + |
| 596 | ** `None`: |
| 597 | + |
| 598 | For each review label only the voting value is shown. Approvals are |
David Pursehouse | a61ee50 | 2016-09-06 16:27:09 +0900 | [diff] [blame] | 599 | rendered as a green check mark icon, vetoes as a red X icon. |
Edwin Kempin | 1f55622 | 2015-04-22 13:24:39 +0200 | [diff] [blame] | 600 | + |
| 601 | ** `Show Name`: |
| 602 | + |
| 603 | For each review label the voting value is shown together with the full |
| 604 | name of the voting user. |
| 605 | + |
| 606 | ** `Show Email`: |
| 607 | + |
| 608 | For each review label the voting value is shown together with the email |
| 609 | address of the voting user. |
| 610 | + |
| 611 | ** `Show Username`: |
| 612 | + |
| 613 | For each review label the voting value is shown together with the |
| 614 | username of the voting user. |
| 615 | + |
| 616 | ** `Show Abbreviated Name`: |
| 617 | + |
| 618 | For each review label the voting value is shown together with the |
| 619 | initials of the full name of the voting user. |
| 620 | |
| 621 | - [[page-size]]`Maximum Page Size`: |
| 622 | + |
| 623 | The maximum number of entries that are shown on one page, e.g. used |
| 624 | when paging through changes, projects, branches or groups. |
| 625 | |
| 626 | - [[date-time-format]]`Date/Time Format`: |
| 627 | + |
| 628 | The format that should be used to render dates and timestamps. |
| 629 | |
Edwin Kempin | 717aa5d | 2016-03-16 16:29:43 +0100 | [diff] [blame] | 630 | - [[email-notifications]]`Email Notifications`: |
| 631 | + |
| 632 | This setting controls the email notifications. |
| 633 | + |
| 634 | ** `Enabled`: |
| 635 | + |
| 636 | Email notifications are enabled. |
| 637 | + |
| 638 | ** [[cc-me]]`CC Me On Comments I Write`: |
| 639 | + |
| 640 | Email notifications are enabled and you get notified by email as CC |
| 641 | on comments that you write yourself. |
| 642 | + |
| 643 | ** `Disabled`: |
| 644 | + |
| 645 | Email notifications are disabled. |
| 646 | |
Edwin Kempin | d540a25 | 2016-09-08 13:29:03 +0200 | [diff] [blame] | 647 | - [[default-base-for-merges]]`Default Base For Merges`: |
| 648 | + |
| 649 | This setting controls which base should be pre-selected in the |
| 650 | `Diff Against` drop-down list when the change screen is opened for a |
| 651 | merge commit. |
| 652 | + |
| 653 | ** `Auto Merge`: |
| 654 | + |
| 655 | Pre-selects `Auto Merge` in the `Diff Against` drop-down list when the |
| 656 | change screen is opened for a merge commit. |
| 657 | + |
| 658 | ** `First Parent`: |
| 659 | + |
| 660 | Pre-selects `Parent 1` in the `Diff Against` drop-down list when the |
| 661 | change screen is opened for a merge commit. |
| 662 | + |
| 663 | |
Edwin Kempin | 717aa5d | 2016-03-16 16:29:43 +0100 | [diff] [blame] | 664 | - [[diff-view]]`Diff View`: |
| 665 | + |
| 666 | Whether the Side-by-Side diff view or the Unified diff view should be |
| 667 | shown when clicking on a file path in the change screen. |
| 668 | |
Sebastian Schuberth | 1ab17d8 | 2016-07-28 17:21:29 +0200 | [diff] [blame] | 669 | - [[show-site-header]]`Show Site Header / Footer`: |
Edwin Kempin | 717aa5d | 2016-03-16 16:29:43 +0100 | [diff] [blame] | 670 | + |
Sebastian Schuberth | 1ab17d8 | 2016-07-28 17:21:29 +0200 | [diff] [blame] | 671 | Whether the site header and footer should be shown. |
Edwin Kempin | 717aa5d | 2016-03-16 16:29:43 +0100 | [diff] [blame] | 672 | |
Edwin Kempin | 1f55622 | 2015-04-22 13:24:39 +0200 | [diff] [blame] | 673 | - [[relative-dates]]`Show Relative Dates In Changes Table`: |
| 674 | + |
| 675 | Whether timestamps in change lists and dashboards should be shown as |
| 676 | relative timestamps, e.g. '12 days ago' instead of absolute timestamps |
| 677 | such as 'Apr 15'. |
| 678 | |
| 679 | - [[change-size-bars]]`Show Change Sizes As Colored Bars`: |
| 680 | + |
| 681 | Whether change sizes should be visualized as colored bars. If disabled |
| 682 | the numbers of added and deleted lines are shown as text, e.g. |
| 683 | '+297, -63'. |
| 684 | |
| 685 | - [[show-change-number]]`Show Change Number In Changes Table`: |
| 686 | + |
| 687 | Whether in change lists and dashboards an `ID` column with the numeric |
| 688 | change IDs should be shown. |
| 689 | |
| 690 | - [[mute-common-path-prefixes]]`Mute Common Path Prefixes In File List`: |
| 691 | + |
| 692 | Whether common path prefixes in the file list on the change screen |
| 693 | should be link:user-review-ui.html#repeating-path-segments[grayed out]. |
| 694 | |
Edwin Kempin | 717aa5d | 2016-03-16 16:29:43 +0100 | [diff] [blame] | 695 | - [[inline-signed-off]]`Insert Signed-off-by Footer For Inline Edit Changes`: |
Edwin Kempin | 1f55622 | 2015-04-22 13:24:39 +0200 | [diff] [blame] | 696 | + |
Edwin Kempin | 717aa5d | 2016-03-16 16:29:43 +0100 | [diff] [blame] | 697 | Whether a `Signed-off-by` footer should be automatically inserted into |
| 698 | changes that are created from the web UI (e.g. by the `Create Change` |
| 699 | and `Edit Config` buttons on the project screen, and the `Follow-Up` |
| 700 | button on the change screen). |
Edwin Kempin | 1f55622 | 2015-04-22 13:24:39 +0200 | [diff] [blame] | 701 | |
Michael Zhou | 2e9aca1 | 2016-03-17 22:45:40 -0400 | [diff] [blame] | 702 | - [[use-flash]]`Use Flash Clipboard Widget`: |
| 703 | + |
| 704 | Whether the Flash clipboard widget should be used. If enabled and the Flash |
| 705 | plugin is available, Gerrit offers a copy-to-clipboard icon next to IDs and |
| 706 | commands that need to be copied frequently, such as the Change-Ids, commit IDs |
| 707 | and download commands. Note that this option is only shown if the Flash plugin |
| 708 | is available and the JavaScript Clipboard API is unavailable. |
| 709 | |
Edwin Kempin | 1f55622 | 2015-04-22 13:24:39 +0200 | [diff] [blame] | 710 | [[my-menu]] |
| 711 | In addition it is possible to customize the menu entries of the `My` |
| 712 | menu. This can be used to make the navigation to frequently used |
| 713 | screens, e.g. configured link:#dashboards[dashboards], quick. |
| 714 | |
Patrick Hiesel | 4362c4f | 2017-02-14 11:52:09 +0100 | [diff] [blame] | 715 | [[reply-by-email]] |
| 716 | == Reply by Email |
| 717 | |
| 718 | Gerrit sends out email notifications to users and supports parsing back replies |
| 719 | on some of them. |
| 720 | |
| 721 | Gerrit supports replies on these notification emails: |
| 722 | |
| 723 | * Notifications about new comments |
| 724 | * Notifications about new labels that were applied or removed |
| 725 | |
| 726 | While Gerrit supports a wide range of email clients, the following ones have |
| 727 | been tested and are known to work: |
| 728 | |
| 729 | * Gmail |
| 730 | * Gmail Mobile |
| 731 | |
| 732 | Gerrit supports parsing back all comment types that can be applied to a change |
| 733 | via the WebUI: |
| 734 | |
| 735 | * Change messages |
| 736 | * Inline comments |
| 737 | * File comments |
| 738 | |
| 739 | Please note that comments can only be sent in reply to a comment in the original |
| 740 | notification email, while the change message is independent of those. |
| 741 | |
| 742 | Gerrit supports parsing a user's reply from both HTML and plaintext. Please note |
| 743 | that some email clients extract the text from the HTML email they have received |
| 744 | and send this back as a quoted reply if you have set the client to plaintext |
| 745 | mode. In this case, Gerrit only supports parsing a change message. To work |
| 746 | around this issue, consider setting a <<email-format,User Preference>> to |
| 747 | receive only plaintext emails. |
| 748 | |
| 749 | Example notification: |
| 750 | ---- |
| 751 | Some User has posted comments on this change. |
| 752 | (https://gerrit-review.googlesource.com/123123 ) |
| 753 | |
| 754 | Change subject: My new change |
| 755 | ...................................................................... |
| 756 | |
| 757 | |
| 758 | Patch Set 3: |
| 759 | |
| 760 | Just a couple of smaller things I found. |
| 761 | |
| 762 | https://gerrit-review.googlesource.com/#/c/123123/3/MyFile.java |
| 763 | File |
| 764 | MyFile.java: |
| 765 | |
| 766 | https://gerrit-review.googlesource.com/#/c/123123/3/MyFile@420 |
| 767 | PS3, Line 420: someMethodCall(param); |
| 768 | Seems to be failing the tests. |
| 769 | |
| 770 | |
| 771 | -- |
| 772 | To view, visit https://gerrit-review.googlesource.com/123123 |
| 773 | To unsubscribe, visit https://gerrit-review.googlesource.com/settings |
| 774 | |
| 775 | (Footers omitted for brevity, must be included in all emails) |
| 776 | ---- |
| 777 | |
| 778 | Example response from the user: |
| 779 | ---- |
| 780 | Thanks, I'll fix it. |
| 781 | > Some User has posted comments on this change. |
| 782 | > (https://gerrit-review.googlesource.com/123123 ) |
| 783 | > |
| 784 | > Change subject: My new change |
| 785 | > ...................................................................... |
| 786 | > |
| 787 | > |
| 788 | > Patch Set 3: |
| 789 | > |
| 790 | > Just a couple of smaller things I found. |
| 791 | > |
| 792 | > https://gerrit-review.googlesource.com/#/c/123123/3/MyFile.java |
| 793 | > File |
| 794 | > MyFile.java: |
| 795 | Rename this file to File.java |
| 796 | > |
| 797 | > https://gerrit-review.googlesource.com/#/c/123123/3/MyFile@420 |
| 798 | > PS3, Line 420: someMethodCall(param); |
| 799 | > Seems to be failing the tests. |
| 800 | > |
| 801 | Yeah, I see why, let me try again. |
| 802 | > |
| 803 | > -- |
| 804 | > To view, visit https://gerrit-review.googlesource.com/123123 |
| 805 | > To unsubscribe, visit https://gerrit-review.googlesource.com/settings |
| 806 | > |
| 807 | > (Footers omitted for brevity, must be included in all emails) |
| 808 | ---- |
| 809 | |
| 810 | In this case, Gerrit will persist a change message ("Thanks, I'll fix it."), |
| 811 | a file comment ("Rename this file to File.java") as well as a reply to an |
| 812 | inline comment ("Yeah, I see why, let me try again."). |
| 813 | |
Edwin Kempin | 1f55622 | 2015-04-22 13:24:39 +0200 | [diff] [blame] | 814 | |
| 815 | GERRIT |
| 816 | ------ |
| 817 | Part of link:index.html[Gerrit Code Review] |
| 818 | |
| 819 | SEARCHBOX |
| 820 | --------- |