blob: 0444fabc884aab5706cacc9a37b31018102e17b1 [file] [log] [blame]
David Shevitz6493b2f2017-08-03 14:53:29 -07001= Changes
2
3A change represents a single commit under review. Each change is identified
4by a <<change-id>>.
5
6Multiple git commits can share the same Change-Id, allowing you to update a
7change as you receive feedback through the code review process. In Gerrit,
8commits that share the same Change-Id are referred to as _patch sets_. When a
9change is approved, only the latest version of a commit is submitted to the
10repository.
11
12You can view a specific change using Gerrit's Review screen. This screen
13provides the following information for each change:
14
15* Current and previous patch sets
16* <<Change properties>>, such as owner, project, and target branch
Jakub Sokół13bac472020-09-17 16:07:50 +020017* Comments
David Shevitz6493b2f2017-08-03 14:53:29 -070018* Votes on link:config-labels.html[Review Labels]
19* The <<change-id>>
20
21[[change-properties]]
22== Change properties
23
24When you open a change in Gerrit, the Review screen displays a number of
25properties about that change.
26
27.Change Properties
28|===
29|Property|Description
30
31|Updated
32|The date on which the change was last updated.
33
34|Owner
35|The contributor who created the change.
36
37|Assignee
38|The contributor responsible for the change. Often used when a change has
39mulitple reviewers to identify the individual responsible for final approval.
40
41|Reviewers
42|A list of one or more contributors responsible for reviewing the change.
43
44|CC
45|A list of one or more contributors who are kept informed about the change, but
46are not required to review it.
47
48|Project
49|The name of the Gerrit project.
50
51|Branch
52|The branch on which the change was made.
53
54|Topic
55|An optional topic.
56
57|Strategy
David Pursehouse3727dba2018-09-27 12:57:37 +090058|The <<submit-strategies,submit strategy>> for the change.
David Shevitz6493b2f2017-08-03 14:53:29 -070059
60|Code Review
61|Displays the Code Review status for the change.
62
63|===
64
65In addition, Gerrit displays the status of any additional labels, such as
66the Verified label, that have been configured for the server. See
67link:config-labels.html[Review Labels] for more information.
68
69[[change-message]]
70== Change Message
71
72Next to the list of change properties is the change message. This message
73contains user-supplied information regarding what the change does. To modify
74the change message, click the *Edit* link.
75
76By default, the change message contains the Change-Id. This ID contains a
77permanent link to a search for that Change-Id in Gerrit.
78
79[[related-changes]]
80== Related Changes
81
82In some cases, a change may be dependent on another change. These changes are
83listed next to the change message. These related changes are grouped together in
84several categories, including:
85
86* Relation Chain. These changes are related by parent-child relationships,
David Pursehouse2919b012018-09-27 12:59:12 +090087 regardless of <<topic,topic>>.
David Shevitz6493b2f2017-08-03 14:53:29 -070088* Merge Conflicts. These are changes in which there is a merge conflict with
89 the current change.
David Pursehouse2919b012018-09-27 12:59:12 +090090* Submitted Together. These are changes that share the same <<topic,topic>>.
David Shevitz6493b2f2017-08-03 14:53:29 -070091
92An arrow indicates the change you are currently viewing.
93
94[[topic]]
95== Topics
96
97Changes can be grouped by topics. Topics make it easier to find related changes
98by using the topic search operator. Changes with the same topic also appear in
99the *Relation Chain* section of the Review screen.
100
101Grouping changes by topics can be helpful when you have several changes that,
102when combined, implement a feature.
103
104Assigning a topic to a change can be done in the change screen or through a `git
105push` command.
106
Albert Cuiacef5c92021-02-26 19:42:27 +0000107For more information about using topics, see the user guide:
108link:cross-repository-changes.html[Submitting Changes Across Repositories by using Topics].
109
David Shevitz6493b2f2017-08-03 14:53:29 -0700110[[submit-strategies]]
111== Submit strategies
112
113Each project in Gerrit can employ a specific submit strategy. This strategy is
114listed in the change properties section of the Review screen.
115
116The following table lists the supported submit strategies.
117
118.Submit Strategies
119|===
120|Strategy|Description
121
122|Fast Forward Only
123|No merge commits are produced. All merges must be handled on the client, before
124submitting the change.
125
126To submit a change, the change must be a strict superset of the destination
127branch.
128
129|Merge If Necessary
130|The default submit strategy. If the change being submitted is a strict superset
131of the destination branch, then the branch is fast-forwarded to the change. If
132not, a merge commit is automatically created at submit time. This is identical
133to the `git merge --ff` command.
134
135|Always Merge
136|Always produce a merge commit, even if the change is a strict superset of the
137destination branch. This is identical to the `git merge --no-ff` command.
138It is often used when users of the project want to be able to read the history
139of submits by running the `git log --first-parent` command.
140
141|Cherry Pick
142|Always cherry pick the patch set, ignoring the parent lineage and instead
143creating a new commit on top of the current branch.
144
145When cherry picking a change, Gerrit automatically appends a short summary of
146the change's approvals and a link back to the change. The committer header is
147also set to the submitter, while the author header retains the original patch
148set author.
149
150NOTE: Gerrit ignores dependencies between changes when using this submit type
151unless `change.submitWholeTopic` is enabled and depending changes share the same
152topic. This means submitters must remember to submit changes in the right order
153when using this submit type.
154
155|Rebase if Necessary
156|If the change being submitted is a strict superset of the destination branch,
157the branch is fast-forwarded to the change. If not, the change is automatically
158rebased and the branch is fast-forwarded to the change.
159
160|Rebase Always
161|Similar to Rebase If Necessary, but creates a new patch set even if fast
162forward is possible. This strategy is also similar to Cherry Pick; however,
163Rebase Always does not ignore dependencies.
164
165|===
166
167Any project owner can use the Project screen to modify the method Gerrit uses
168to submit a change.
169
170[[change-id]]
171== Change-Id
172
173Gerrit uses a Change-Id to identify which patch sets belong to the same review.
174For example, you make a change to a project. A reviewer supplies some feedback,
Jonathan Nieder988abed2018-04-25 17:54:54 -0700175which you address in an amended commit. By assigning the same Change-Id to both
David Shevitz6493b2f2017-08-03 14:53:29 -0700176commits, Gerrit can attach those commits to the same change.
177
178Change-Ids are appended to the end of a commit message, and resemble the
179following:
180
181....
182commit 29a6bb1a059aef021ac39d342499191278518d1d
183Author: A. U. Thor <author@example.com>
184Date: Thu Aug 20 12:46:50 2009 -0700
185
186 Improve foo widget by attaching a bar.
187
188 We want a bar, because it improves the foo by providing more
189 wizbangery to the dowhatimeanery.
190
191 Bug: #42
192 Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5b
193 Signed-off-by: A. U. Thor <author@example.com>
194 CC: R. E. Viewer <reviewer@example.com>
195....
196
197Gerrit requires that the Change-Id is in the footer (last paragraph) of a
198commit message. It can be combined with a Signed-off-by, CC, or other lines. For
199instance, the previous example has a Change-Id, along with a Signed-off-by and
200CC line.
201
202Notice that the Change-Id is similar to the commit id. To avoid confusing the
203two, a Change-Id typically begins with an `I`.
204
205While there are several ways you can add a Change-Id, the standard
206method uses git's link:cmd-hook-commit-msg.html[commit-msg hook]
207to automatically add the Change-Id to each new commit.
208
Peter Collingbourne8cab9332020-08-18 14:42:44 -0700209== The Link footer
210
211Gerrit also supports the Link footer as an alternative to the Change-Id
212footer. A Link footer looks like this:
213
214....
215 Link: https://gerrit-review.googlesource.com/id/Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5b
216....
217
218The advantage of this style of footer is that it usually acts
219as a link directly to the change's review page, provided that
220the change has been uploaded to Gerrit. Projects such as the
221link:https://www.kernel.org/doc/html/latest/maintainer/configure-git.html#creating-commit-links-to-lore-kernel-org[Linux kernel]
222have a convention of adding links to commit messages using the
223Link footer.
224
225If multiple changes have been uploaded to Gerrit with the same
226change ID, for example if a change has been cherry-picked to multiple
227branches, the link will take the user to a list of changes.
228
229The base URL in the footer is required to match the server's base URL.
230If the URL does not match, the server will not recognize the footer
231as a change ID footer.
232
233The link:cmd-hook-commit-msg.html[commit-msg hook] can be configured
234to insert Link footers instead of Change-Id footers by setting the
235property `gerrit.reviewUrl` to the base URL of the Gerrit server.
236
David Shevitz6493b2f2017-08-03 14:53:29 -0700237GERRIT
238------
239Part of link:index.html[Gerrit Code Review]
240
241SEARCHBOX
242---------