Marian Harbach | ebeb154 | 2019-12-13 10:42:46 +0100 | [diff] [blame] | 1 | :linkattrs: |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 2 | = Creating and Editing Changes in the Gerrit Web Interface |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 3 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 4 | == Overview |
| 5 | |
| 6 | The following content explains how to use the Gerrit web interface to create |
| 7 | and edit changes. Use the web interface to make minor changes to files. When |
| 8 | you create a change in the Gerrit user interface, you don't clone a Gerrit |
| 9 | repository or use the CLI to issue Git commands — you perform your work |
| 10 | directly in the Gerrit web interface. |
| 11 | |
| 12 | To learn more, see the link:intro-user.html[Gerrit User's Guide]. |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 13 | |
| 14 | |
| 15 | [[create-change]] |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 16 | == Creating a Change |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 17 | |
Sven Selberg | 8d8f08e | 2023-10-31 11:48:11 +0100 | [diff] [blame] | 18 | [[create_in_web_interface]] |
| 19 | === In the web interface |
| 20 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 21 | To create a change in the Gerrit web interface: |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 22 | |
Marian Harbach | 3425337 | 2019-12-10 18:01:31 +0100 | [diff] [blame] | 23 | . From the link:http://gerrit-review.googlesource.com[Gerrit Code Review,role=external,window=_blank] |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 24 | dashboard, select Browse > Repositories. |
David Pursehouse | 0a1da09 | 2015-01-30 15:08:17 +0900 | [diff] [blame] | 25 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 26 | . Under Repository Name, click the name of the repository you want to work |
| 27 | on. For example, Public-Projects. To find a specific repository, enter all |
| 28 | or part of its name next to Filter: |
| 29 | + |
| 30 | image::images/inline-edit-home-page.png[width=600] |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 31 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 32 | . In the left navigation panel for the repository you selected, click |
| 33 | Commands: |
| 34 | + |
| 35 | image::images/inline-edit-create-change.png[width=350] |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 36 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 37 | . Under Repository Commands, click Create Change. |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 38 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 39 | . In the Create Change window, enter the following information: |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 40 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 41 | * Select branch for new change: Specify the destination branch of the |
| 42 | change. |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 43 | |
Han-Wen Nienhuys | 37a1cab | 2021-04-01 12:46:00 +0200 | [diff] [blame] | 44 | * Provide base commit SHA-1 for change: Leave this field blank. |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 45 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 46 | + |
Han-Wen Nienhuys | 37a1cab | 2021-04-01 12:46:00 +0200 | [diff] [blame] | 47 | IMPORTANT: Git uses a unique SHA-1 value to identify each and every commit (in |
| 48 | other words, each Git commit generates a new SHA-1 hash). This value differs |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 49 | from a Gerrit Change-Id, which is used by Gerrit to uniquely identify a |
| 50 | change. The Gerrit Change-Id remains static throughout the life of a Gerrit |
| 51 | change. |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 52 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 53 | - Description: Briefly describe the change. Be sure to use the |
| 54 | link:dev-contributing.html#commit-message[Commit Message] format. |
| 55 | The first line becomes the subject of the change and is included in |
| 56 | the Commit Message. Because the message also appears on its own in |
| 57 | dashboards and in the results of `git log --pretty=oneline output`, |
| 58 | make the message informative and brief. |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 59 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 60 | - Private change: Select this option to designate this change as private. |
| 61 | Only you (and any reviewers you add) can see your private changes. |
| 62 | |
| 63 | . On the Create Change window, click Create. Gerrit creates a public Work |
| 64 | In Progress (WIP) change. Until the change is sent for review, it remains a |
| 65 | WIP and appears in _your_ dashboard only. In addition, all email |
| 66 | notifications are turned off. |
| 67 | |
| 68 | . Add the files you want to be reviewed. |
| 69 | |
Sven Selberg | 8d8f08e | 2023-10-31 11:48:11 +0100 | [diff] [blame] | 70 | [[create_from_url]] |
| 71 | === From URL |
| 72 | |
| 73 | Gerrit supports creating a new change and opening a specific file for edit |
| 74 | in that change from an "Edit URL": |
| 75 | ``` |
| 76 | ^\/admin\/repos\/edit\/repo\/(.+)\/branch\/(.+)\/file\/(.+)$ |
| 77 | ``` |
| 78 | This enables other tools to provide a direct link to edit their configuration |
| 79 | files in Gerrit. |
| 80 | |
| 81 | Ex: |
| 82 | ``` |
Sven Selberg | e579b38 | 2023-11-09 12:01:38 +0000 | [diff] [blame] | 83 | https://gerrit.mycompany.com/admin/repos/edit/repo/my/repo/branch/refs/heads/master/file/Jenkinsfile # Jenkins build file |
| 84 | https://gerrit.mycompany.com/admin/repos/edit/repo/my/repo/branch/refs/heads/master/file/catalog-info.yaml # Backstage catalog-info |
Sven Selberg | 8d8f08e | 2023-10-31 11:48:11 +0100 | [diff] [blame] | 85 | ``` |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 86 | |
| 87 | [[add-files]] |
| 88 | == Adding a File to a Change |
| 89 | |
| 90 | Files can only be added to changes that have not been merged into the code |
| 91 | base. |
| 92 | |
| 93 | To add a file to the change: |
| 94 | |
Alex Saveau | 9b3cfd8 | 2019-07-31 03:11:16 +0000 | [diff] [blame] | 95 | . In the top right corner of the change, click Edit. |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 96 | . Next to Files, click Open: |
| 97 | |
| 98 | + |
| 99 | image::images/inline-edit-open-file.png[width=600] |
| 100 | |
| 101 | . In the Open File window, do one of the following: |
| 102 | |
| 103 | * To add an existing file: |
| 104 | |
| 105 | ** Enter all or part of the file name in the text box. Gerrit automatically |
| 106 | populates a list of possible matching files: |
| 107 | + |
| 108 | image::images/inline-edit-prefill-files.png[width=500] |
| 109 | + |
| 110 | ** Select the file you want to add to the change. |
| 111 | ** Click Open. |
| 112 | + |
| 113 | _or,_ |
| 114 | |
| 115 | * To create a new file, enter the name of the new file you want to add to the |
| 116 | change and then click Open. |
| 117 | |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 118 | |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 119 | [[editing-change]] |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 120 | == Modifying a Change |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 121 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 122 | To work on a file you've added to a change: |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 123 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 124 | . On the change page, click the file name. When you add a new file to a |
| 125 | change, a blank page is displayed. When you add an existing file to a |
| 126 | change, the entire file is displayed. |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 127 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 128 | . Update the file and then click Save. You _must_ click Save to add the |
| 129 | file to the change. |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 130 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 131 | . To close the text editor and display the change page, click Close. |
| 132 | + |
| 133 | When you save your work and close the file, the file is added to the change |
| 134 | and the file name is listed in the Files section. The letter displayed to the |
| 135 | left of the file name denotes the action performed on the file. In this case, |
| 136 | one file was modified: |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 137 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 138 | - M: Modified |
| 139 | - A: Added |
| 140 | - D: Deleted |
| 141 | + |
| 142 | image::images/inline-edit-add-file-page.png[width=650] |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 143 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 144 | . When you're done editing and adding files, click Stop Editing. |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 145 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 146 | . Click Publish Edit. When you publish an edit, you promote it to a regular |
| 147 | patch set. The special ref that represents the change is deleted when the |
| 148 | change is published. |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 149 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 150 | Not happy with your edits? Click Delete Edit. |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 151 | |
David Pursehouse | 1713820 | 2015-10-20 13:35:55 +0900 | [diff] [blame] | 152 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 153 | [[submit-change]] |
| 154 | == Starting the Review |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 155 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 156 | When you start a review, Gerrit removes the WIP designation and submits |
| 157 | the change to code review. The change appears in other Gerrit dashboards and |
| 158 | reviewers are notified when the change is updated. |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 159 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 160 | To start a review: |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 161 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 162 | . Open the change and then click Start Review: |
| 163 | + |
| 164 | image::images/inline-edit-start-review-button.png[width=400] |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 165 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 166 | . In the change notification form: |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 167 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 168 | ** Add the names of the reviewers and anyone else you want to copy. |
| 169 | ** Describe the change. |
| 170 | ** Click Start Review: |
| 171 | + |
| 172 | image::images/inline-edit-review-message.png[width=550] |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 173 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 174 | The change is now displayed in other Gerrit dashboards and reviewers are |
| 175 | notified that the change is available for code review. |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 176 | |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 177 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 178 | [[review-edits]] |
| 179 | == Reviewing Changes |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 180 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 181 | Use the side-by-side diff screen. |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 182 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 183 | image::images/inline-edit-diff-screen.png[width=800] |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 184 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 185 | It's possible that subsequent patch sets may exist. For example, this sequence |
| 186 | means that the change was created on top of patch set 9 while a regular |
| 187 | patchset was uploaded later: |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 188 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 189 | 1 2 3 4 5 6 7 8 9 edit 10 |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 190 | |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 191 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 192 | [[search-for-changes]] |
| 193 | == Searching for Changes with Pending Edits |
David Pursehouse | 6621209 | 2015-01-07 15:47:40 +0900 | [diff] [blame] | 194 | |
Nitzan Gur-Furman | cbf9a8f | 2023-03-08 13:21:18 +0100 | [diff] [blame] | 195 | To find changes with pending edits created by you: |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 196 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 197 | * From the Gerrit dashboard, select Your > Changes. All your changes are |
| 198 | listed, according to Work in progress, Outgoing reviews, Incoming reviews, |
| 199 | CCed on, and Recently closed. |
David Ostrovsky | 6679609 | 2014-12-24 14:30:00 +0100 | [diff] [blame] | 200 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 201 | For more information about Search operators, see |
| 202 | link:user-search.html[Searching Changes]. For example, to find only |
| 203 | those changes that contain edits, see link:user-search.html#has[has:edit]. |
David Ostrovsky | 6679609 | 2014-12-24 14:30:00 +0100 | [diff] [blame] | 204 | |
Nitzan Gur-Furman | cbf9a8f | 2023-03-08 13:21:18 +0100 | [diff] [blame] | 205 | [NOTE] |
| 206 | Though edits created by others are not accessible from the Gerrit UI, edits |
| 207 | are not considered to be private data, and are stored in non-encrypted special |
| 208 | branches under the target repository. As such, they can be accessed by users who |
| 209 | have access to the repository. |
| 210 | |
David Ostrovsky | 6679609 | 2014-12-24 14:30:00 +0100 | [diff] [blame] | 211 | |
David Pursehouse | f6ee94a | 2018-10-09 16:06:35 +0900 | [diff] [blame] | 212 | [[change-edit-actions]] |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 213 | == Modifying Changes |
David Ostrovsky | 6679609 | 2014-12-24 14:30:00 +0100 | [diff] [blame] | 214 | |
David Ostrovsky | 6679609 | 2014-12-24 14:30:00 +0100 | [diff] [blame] | 215 | |
| 216 | [[rebase-change-edit]] |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 217 | === Rebasing a Change Edit |
David Ostrovsky | 6679609 | 2014-12-24 14:30:00 +0100 | [diff] [blame] | 218 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 219 | Only when a change is based on the current patch set can the change be |
| 220 | published. In the meantime, if a new patch set has been uploaded, the change |
| 221 | must be rebased on top of the current patch set before the change can be |
| 222 | published. |
David Ostrovsky | 6679609 | 2014-12-24 14:30:00 +0100 | [diff] [blame] | 223 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 224 | To rebase a change: |
| 225 | |
| 226 | - Open the change and then click Rebase Edit. |
| 227 | |
| 228 | If the rebase generates conflicts, the conflicts can't be resolved in the web |
| 229 | interface. Instead, the change must be downloaded (see below) and the conflicts |
| 230 | resolved in the local environment. |
| 231 | |
| 232 | When the conflicts are resolved in the local environment, the commit that |
| 233 | contains the conflict resolution can be uploaded by setting `edit` as an |
| 234 | option on the target ref. For example: |
| 235 | |
| 236 | .... |
| 237 | $ git push host HEAD:refs/for/master%edit |
| 238 | .... |
| 239 | |
David Ostrovsky | 6679609 | 2014-12-24 14:30:00 +0100 | [diff] [blame] | 240 | |
| 241 | [[download-change-edit-patch]] |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 242 | === Downloading a Patch |
David Ostrovsky | 6679609 | 2014-12-24 14:30:00 +0100 | [diff] [blame] | 243 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 244 | As with regular patch sets, you can download changes. For example, as provided |
| 245 | by the `download-commands` plugin. Only the owners of a change and those |
| 246 | users granted the |
| 247 | link:access-control.html#capability_accessDatabase[accessDatabase] global |
| 248 | capability can access change refs. |
David Ostrovsky | 6679609 | 2014-12-24 14:30:00 +0100 | [diff] [blame] | 249 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 250 | To download a change: |
David Ostrovsky | 9952870 | 2015-04-30 23:48:35 +0200 | [diff] [blame] | 251 | |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 252 | . Open the change, click the More icon, and then select Download patch. |
| 253 | . Copy the desired scheme from the Download drop-down. |
| 254 | . Paste the command into a terminal window. |
David Ostrovsky | 9952870 | 2015-04-30 23:48:35 +0200 | [diff] [blame] | 255 | |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 256 | GERRIT |
Janet Davies | 6bcacb2 | 2018-08-14 11:58:20 -0700 | [diff] [blame] | 257 | |
David Ostrovsky | 6842df9 | 2014-12-19 09:20:31 +0100 | [diff] [blame] | 258 | Part of link:index.html[Gerrit Code Review] |
| 259 | |
David Pursehouse | f6ee94a | 2018-10-09 16:06:35 +0900 | [diff] [blame] | 260 | SEARCHBOX |