blob: 7ed87b6c3e08fd1ec4cb21f0adff6b6bcfedddb6 [file] [log] [blame]
Marian Harbachebeb1542019-12-13 10:42:46 +01001:linkattrs:
Janet Davies6bcacb22018-08-14 11:58:20 -07002= Creating and Editing Changes in the Gerrit Web Interface
David Ostrovsky6842df92014-12-19 09:20:31 +01003
Janet Davies6bcacb22018-08-14 11:58:20 -07004== Overview
5
6The following content explains how to use the Gerrit web interface to create
7and edit changes. Use the web interface to make minor changes to files. When
8you create a change in the Gerrit user interface, you don't clone a Gerrit
9repository or use the CLI to issue Git commands — you perform your work
10directly in the Gerrit web interface.
11
12To learn more, see the link:intro-user.html[Gerrit User's Guide].
David Ostrovsky6842df92014-12-19 09:20:31 +010013
14
15[[create-change]]
Janet Davies6bcacb22018-08-14 11:58:20 -070016== Creating a Change
David Ostrovsky6842df92014-12-19 09:20:31 +010017
Sven Selberg8d8f08e2023-10-31 11:48:11 +010018[[create_in_web_interface]]
19=== In the web interface
20
Janet Davies6bcacb22018-08-14 11:58:20 -070021To create a change in the Gerrit web interface:
David Ostrovsky6842df92014-12-19 09:20:31 +010022
Marian Harbach34253372019-12-10 18:01:31 +010023. From the link:http://gerrit-review.googlesource.com[Gerrit Code Review,role=external,window=_blank]
Janet Davies6bcacb22018-08-14 11:58:20 -070024 dashboard, select Browse > Repositories.
David Pursehouse0a1da092015-01-30 15:08:17 +090025
Janet Davies6bcacb22018-08-14 11:58:20 -070026. 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+
30image::images/inline-edit-home-page.png[width=600]
David Ostrovsky6842df92014-12-19 09:20:31 +010031
Janet Davies6bcacb22018-08-14 11:58:20 -070032. In the left navigation panel for the repository you selected, click
33 Commands:
34+
35image::images/inline-edit-create-change.png[width=350]
David Ostrovsky6842df92014-12-19 09:20:31 +010036
Janet Davies6bcacb22018-08-14 11:58:20 -070037. Under Repository Commands, click Create Change.
David Ostrovsky6842df92014-12-19 09:20:31 +010038
Janet Davies6bcacb22018-08-14 11:58:20 -070039. In the Create Change window, enter the following information:
David Ostrovsky6842df92014-12-19 09:20:31 +010040
Janet Davies6bcacb22018-08-14 11:58:20 -070041 * Select branch for new change: Specify the destination branch of the
42 change.
David Ostrovsky6842df92014-12-19 09:20:31 +010043
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +020044 * Provide base commit SHA-1 for change: Leave this field blank.
David Ostrovsky6842df92014-12-19 09:20:31 +010045
Janet Davies6bcacb22018-08-14 11:58:20 -070046+
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +020047IMPORTANT: Git uses a unique SHA-1 value to identify each and every commit (in
48other words, each Git commit generates a new SHA-1 hash). This value differs
Janet Davies6bcacb22018-08-14 11:58:20 -070049from a Gerrit Change-Id, which is used by Gerrit to uniquely identify a
50change. The Gerrit Change-Id remains static throughout the life of a Gerrit
51change.
David Ostrovsky6842df92014-12-19 09:20:31 +010052
Janet Davies6bcacb22018-08-14 11:58:20 -070053 - 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 Ostrovsky6842df92014-12-19 09:20:31 +010059
Janet Davies6bcacb22018-08-14 11:58:20 -070060 - 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 Selberg8d8f08e2023-10-31 11:48:11 +010070[[create_from_url]]
71=== From URL
72
73Gerrit supports creating a new change and opening a specific file for edit
74in that change from an "Edit URL":
75```
76^\/admin\/repos\/edit\/repo\/(.+)\/branch\/(.+)\/file\/(.+)$
77```
78This enables other tools to provide a direct link to edit their configuration
79files in Gerrit.
80
81Ex:
82```
Sven Selberge579b382023-11-09 12:01:38 +000083https://gerrit.mycompany.com/admin/repos/edit/repo/my/repo/branch/refs/heads/master/file/Jenkinsfile # Jenkins build file
84https://gerrit.mycompany.com/admin/repos/edit/repo/my/repo/branch/refs/heads/master/file/catalog-info.yaml # Backstage catalog-info
Sven Selberg8d8f08e2023-10-31 11:48:11 +010085```
Janet Davies6bcacb22018-08-14 11:58:20 -070086
87[[add-files]]
88== Adding a File to a Change
89
90Files can only be added to changes that have not been merged into the code
91base.
92
93To add a file to the change:
94
Alex Saveau9b3cfd82019-07-31 03:11:16 +000095. In the top right corner of the change, click Edit.
Janet Davies6bcacb22018-08-14 11:58:20 -070096. Next to Files, click Open:
97
98+
99image::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+
108image::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
116change and then click Open.
117
David Ostrovsky6842df92014-12-19 09:20:31 +0100118
David Pursehouse66212092015-01-07 15:47:40 +0900119[[editing-change]]
Janet Davies6bcacb22018-08-14 11:58:20 -0700120== Modifying a Change
David Pursehouse66212092015-01-07 15:47:40 +0900121
Janet Davies6bcacb22018-08-14 11:58:20 -0700122To work on a file you've added to a change:
David Pursehouse66212092015-01-07 15:47:40 +0900123
Janet Davies6bcacb22018-08-14 11:58:20 -0700124. 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 Pursehouse66212092015-01-07 15:47:40 +0900127
Janet Davies6bcacb22018-08-14 11:58:20 -0700128. Update the file and then click Save. You _must_ click Save to add the
129 file to the change.
David Pursehouse66212092015-01-07 15:47:40 +0900130
Janet Davies6bcacb22018-08-14 11:58:20 -0700131. To close the text editor and display the change page, click Close.
132+
133When you save your work and close the file, the file is added to the change
134and the file name is listed in the Files section. The letter displayed to the
135left of the file name denotes the action performed on the file. In this case,
136one file was modified:
David Pursehouse66212092015-01-07 15:47:40 +0900137
Janet Davies6bcacb22018-08-14 11:58:20 -0700138- M: Modified
139- A: Added
140- D: Deleted
141+
142image::images/inline-edit-add-file-page.png[width=650]
David Pursehouse66212092015-01-07 15:47:40 +0900143
Janet Davies6bcacb22018-08-14 11:58:20 -0700144. When you're done editing and adding files, click Stop Editing.
David Pursehouse66212092015-01-07 15:47:40 +0900145
Janet Davies6bcacb22018-08-14 11:58:20 -0700146. 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 Pursehouse66212092015-01-07 15:47:40 +0900149
Janet Davies6bcacb22018-08-14 11:58:20 -0700150Not happy with your edits? Click Delete Edit.
David Pursehouse66212092015-01-07 15:47:40 +0900151
David Pursehouse17138202015-10-20 13:35:55 +0900152
Janet Davies6bcacb22018-08-14 11:58:20 -0700153[[submit-change]]
154== Starting the Review
David Pursehouse66212092015-01-07 15:47:40 +0900155
Janet Davies6bcacb22018-08-14 11:58:20 -0700156When you start a review, Gerrit removes the WIP designation and submits
157the change to code review. The change appears in other Gerrit dashboards and
158reviewers are notified when the change is updated.
David Pursehouse66212092015-01-07 15:47:40 +0900159
Janet Davies6bcacb22018-08-14 11:58:20 -0700160To start a review:
David Pursehouse66212092015-01-07 15:47:40 +0900161
Janet Davies6bcacb22018-08-14 11:58:20 -0700162. Open the change and then click Start Review:
163+
164image::images/inline-edit-start-review-button.png[width=400]
David Pursehouse66212092015-01-07 15:47:40 +0900165
Janet Davies6bcacb22018-08-14 11:58:20 -0700166. In the change notification form:
David Pursehouse66212092015-01-07 15:47:40 +0900167
Janet Davies6bcacb22018-08-14 11:58:20 -0700168 ** Add the names of the reviewers and anyone else you want to copy.
169 ** Describe the change.
170 ** Click Start Review:
171+
172image::images/inline-edit-review-message.png[width=550]
David Pursehouse66212092015-01-07 15:47:40 +0900173
Janet Davies6bcacb22018-08-14 11:58:20 -0700174The change is now displayed in other Gerrit dashboards and reviewers are
175notified that the change is available for code review.
David Pursehouse66212092015-01-07 15:47:40 +0900176
David Pursehouse66212092015-01-07 15:47:40 +0900177
Janet Davies6bcacb22018-08-14 11:58:20 -0700178[[review-edits]]
179== Reviewing Changes
David Pursehouse66212092015-01-07 15:47:40 +0900180
Janet Davies6bcacb22018-08-14 11:58:20 -0700181Use the side-by-side diff screen.
David Pursehouse66212092015-01-07 15:47:40 +0900182
Janet Davies6bcacb22018-08-14 11:58:20 -0700183image::images/inline-edit-diff-screen.png[width=800]
David Pursehouse66212092015-01-07 15:47:40 +0900184
Janet Davies6bcacb22018-08-14 11:58:20 -0700185It's possible that subsequent patch sets may exist. For example, this sequence
186means that the change was created on top of patch set 9 while a regular
187patchset was uploaded later:
David Pursehouse66212092015-01-07 15:47:40 +0900188
Janet Davies6bcacb22018-08-14 11:58:20 -07001891 2 3 4 5 6 7 8 9 edit 10
David Pursehouse66212092015-01-07 15:47:40 +0900190
David Pursehouse66212092015-01-07 15:47:40 +0900191
Janet Davies6bcacb22018-08-14 11:58:20 -0700192[[search-for-changes]]
193== Searching for Changes with Pending Edits
David Pursehouse66212092015-01-07 15:47:40 +0900194
Nitzan Gur-Furmancbf9a8f2023-03-08 13:21:18 +0100195To find changes with pending edits created by you:
David Ostrovsky6842df92014-12-19 09:20:31 +0100196
Janet Davies6bcacb22018-08-14 11:58:20 -0700197* From the Gerrit dashboard, select Your > Changes. All your changes are
198listed, according to Work in progress, Outgoing reviews, Incoming reviews,
199CCed on, and Recently closed.
David Ostrovsky66796092014-12-24 14:30:00 +0100200
Janet Davies6bcacb22018-08-14 11:58:20 -0700201For more information about Search operators, see
202link:user-search.html[Searching Changes]. For example, to find only
203those changes that contain edits, see link:user-search.html#has[has:edit].
David Ostrovsky66796092014-12-24 14:30:00 +0100204
Nitzan Gur-Furmancbf9a8f2023-03-08 13:21:18 +0100205[NOTE]
206Though edits created by others are not accessible from the Gerrit UI, edits
207are not considered to be private data, and are stored in non-encrypted special
208branches under the target repository. As such, they can be accessed by users who
209have access to the repository.
210
David Ostrovsky66796092014-12-24 14:30:00 +0100211
David Pursehousef6ee94a2018-10-09 16:06:35 +0900212[[change-edit-actions]]
Janet Davies6bcacb22018-08-14 11:58:20 -0700213== Modifying Changes
David Ostrovsky66796092014-12-24 14:30:00 +0100214
David Ostrovsky66796092014-12-24 14:30:00 +0100215
216[[rebase-change-edit]]
Janet Davies6bcacb22018-08-14 11:58:20 -0700217=== Rebasing a Change Edit
David Ostrovsky66796092014-12-24 14:30:00 +0100218
Janet Davies6bcacb22018-08-14 11:58:20 -0700219Only when a change is based on the current patch set can the change be
220published. In the meantime, if a new patch set has been uploaded, the change
221must be rebased on top of the current patch set before the change can be
222published.
David Ostrovsky66796092014-12-24 14:30:00 +0100223
Janet Davies6bcacb22018-08-14 11:58:20 -0700224To rebase a change:
225
226- Open the change and then click Rebase Edit.
227
228If the rebase generates conflicts, the conflicts can't be resolved in the web
229interface. Instead, the change must be downloaded (see below) and the conflicts
230resolved in the local environment.
231
232When the conflicts are resolved in the local environment, the commit that
233contains the conflict resolution can be uploaded by setting `edit` as an
234option on the target ref. For example:
235
236....
237$ git push host HEAD:refs/for/master%edit
238....
239
David Ostrovsky66796092014-12-24 14:30:00 +0100240
241[[download-change-edit-patch]]
Janet Davies6bcacb22018-08-14 11:58:20 -0700242=== Downloading a Patch
David Ostrovsky66796092014-12-24 14:30:00 +0100243
Janet Davies6bcacb22018-08-14 11:58:20 -0700244As with regular patch sets, you can download changes. For example, as provided
245by the `download-commands` plugin. Only the owners of a change and those
246users granted the
247link:access-control.html#capability_accessDatabase[accessDatabase] global
248capability can access change refs.
David Ostrovsky66796092014-12-24 14:30:00 +0100249
Janet Davies6bcacb22018-08-14 11:58:20 -0700250To download a change:
David Ostrovsky99528702015-04-30 23:48:35 +0200251
Janet Davies6bcacb22018-08-14 11:58:20 -0700252. 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 Ostrovsky99528702015-04-30 23:48:35 +0200255
David Ostrovsky6842df92014-12-19 09:20:31 +0100256GERRIT
Janet Davies6bcacb22018-08-14 11:58:20 -0700257
David Ostrovsky6842df92014-12-19 09:20:31 +0100258Part of link:index.html[Gerrit Code Review]
259
David Pursehousef6ee94a2018-10-09 16:06:35 +0900260SEARCHBOX