1GIT-REVIEW(1) BSD General Commands Manual GIT-REVIEW(1)
2
4 git-review — Submit changes to Gerrit for review
5
7 git-review [-r remote] [-uv] -d change [branch]
8 git-review [-r remote] [-uv] -x change [branch]
9 git-review [-r remote] [-uv] -N change [branch]
10 git-review [-r remote] [-uv] -X change [branch]
11 git-review [-r remote] [-uv] -m change-ps-range [branch]
12 git-review [-r remote] [-fnuv] -s [branch]
13 git-review [-fnuvDRT] [-r remote] [-t topic] [--reviewers reviewer ...]
14 [branch]
15 git-review -l
16 git-review --version
17
19 git-review automates and streamlines some of the tasks involved with sub‐
20 mitting local changes to a Gerrit server for review. It is designed to
21 make it easier to comprehend Gerrit, especially for users that have
22 recently switched to Git from another version control system.
23
24 change can be changeNumber as obtained using --list option, or it can be
25 changeNumber,patchsetNumber for fetching exact patchset from the change.
26 In that case local branch name will have a -patch[patchsetNumber] suffix.
27
28 The following options are available:
29
30 -c, --compatible
31 Push changes to refs compatible with Gerrit of versions before
32 2.3.
33
34 -d change, --download=change
35 Download change from Gerrit into a local branch. The branch will
36 be named after the patch author and the name of a topic. If the
37 local branch already exists, it will attempt to update with the
38 latest patchset for this change.
39
40 -x change, --cherrypick=change
41 Apply change from Gerrit and commit into the current local branch
42 ("cherry pick"). No additional branch is created.
43
44 This makes it possible to review a change without creating a
45 local branch for it. On the other hand, be aware: if you are not
46 careful, this can easily result in additional patch sets for
47 dependent changes. Also, if the current branch is different
48 enough, the change may not apply at all or produce merge con‐
49 flicts that need to be resolved by hand.
50
51 -N change, --cherrypickonly=change
52 Apply change from Gerrit into the current working directory, add
53 it to the staging area ("git index"), but do not commit it.
54
55 This makes it possible to review a change without creating a
56 local commit for it. Useful if you want to merge several commits
57 into one that will be submitted for review.
58
59 If the current branch is different enough, the change may not
60 apply at all or produce merge conflicts that need to be resolved
61 by hand.
62
63 -X change, --cherrypickindicate=change
64 Apply change from Gerrit and commit into the current local branch
65 ("cherry pick"), indicating which commit this change was
66 cherry-picked from.
67
68 This makes it possible to re-review a change for a different
69 branch without creating a local branch for it.
70
71 If the current branch is different enough, the change may not
72 apply at all or produce merge conflicts that need to be resolved
73 by hand.
74
75 -i, --new-changeid
76 Force the git-review to generate a new Change-Id, even if one
77 already exists in the changelog.
78
79 -m change-ps-range, --compare=change-ps-range
80 Download the specified patchsets for change from Gerrit, rebase
81 both on master and display differences (git-diff).
82
83 change-ps-range can be specified as
84 changeNumber,oldPatchSetNumber[-newPatchSetNumber]
85
86 oldPatchSetNumber is mandatory, and if newPatchSetNumber is not
87 specified, the latest patchset will be used.
88
89 This makes it possible to easily compare what has changed from
90 last time you reviewed the proposed change.
91
92 If the master branch is different enough, the rebase can produce
93 merge conflicts. If that happens rebasing will be aborted and
94 diff displayed for not-rebased branches. You can also use
95 --no-rebase (-R) to always skip rebasing.
96
97 -f, --finish
98 Close down the local branch and switch back to the target branch
99 on successful submission.
100
101 -F, --force-rebase
102 Force a rebase before doing anything else, even if not otherwise
103 needed.
104
105 -n, --dry-run
106 Don't actually perform any commands that have direct effects.
107 Print them instead.
108
109 -r remote, --remote=remote
110 Git remote to use for Gerrit.
111
112 -s, --setup
113 Just run the repo setup commands but don't submit anything.
114
115 -t topic, --topic=topic
116 Sets the target topic for this change on the Gerrit server. If
117 not specified, a bug number from the commit summary will be used.
118 Alternatively, the local branch name will be used if different
119 from remote branch.
120
121 -T, --no-topic
122 Submit review without topic.
123
124 --reviewers reviewer ...
125 Subscribe one or more reviewers to the uploaded patch sets.
126 Reviewers should be identifiable by Gerrit (usually use their
127 Gerrit username or email address).
128
129 -u, --update
130 Skip cached local copies and force updates from network
131 resources.
132
133 -l, --list
134 List the available reviews on the Gerrit server for this project.
135
136 -y, --yes
137 Indicate that you do, in fact, understand if you are submitting
138 more than one patch.
139
140 -v, --verbose
141 Turns on more verbose output.
142
143 -D, --draft
144 Submit review as a draft. Requires Gerrit 2.3 or newer.
145
146 -R, --no-rebase
147 Do not automatically perform a rebase before submitting the
148 change to Gerrit.
149
150 When submitting a change for review, you will usually want it to
151 be based on the tip of upstream branch in order to avoid possible
152 conflicts. When amending a change and rebasing the new patchset,
153 the Gerrit web interface will show a difference between the two
154 patchsets which contains all commits in between. This may confuse
155 many reviewers that would expect to see a much simpler differ‐
156 ence.
157
158 Also can be used for --compare to skip automatic rebase of
159 fetched reviews.
160
161 --color always|never|auto
162 Enable or disable a color output. Default is "auto".
163
164 --no-color
165 Same thing as --color=never.
166
167 --no-custom-script
168 Do not run scripts, installed as hooks/{action}-review, where
169 action is one of "pre", "draft", or "post".
170
171 --track
172 Choose the branch to submit the change against (and, if rebasing,
173 to rebase against) from the branch being tracked (if a branch is
174 being tracked), and set the tracking branch when downloading a
175 change to point to the remote and branch against which patches
176 should be submitted. See gitreview.track configuration.
177
178 --no-track
179 Ignore any branch being tracked by the current branch, overriding
180 gitreview.track. This option is implied by providing a specific
181 branch name on the command line.
182
183 --use-pushurl
184 Use the pushurl option for the origin remote rather than conven‐
185 tional separate Gerrit remotes.
186
187 --version
188 Print the version number and exit.
189
191 This utility can be configured by adding entries to Git configuration.
192
193 The following configuration keys are supported:
194
195 gitreview.username
196 Default username used to access the repository. If not
197 specified in the Git configuration, Git remote or
198 .gitreview file, the user will be prompted to specify the
199 username.
200
201 Example entry in the .gitconfig file:
202
203 [gitreview]
204 username=mygerrituser
205
206 gitreview.scheme
207 This setting determines the default scheme (ssh/http/https)
208 of gerrit remote
209
210 gitreview.host
211 This setting determines the default hostname of gerrit
212 remote
213
214 gitreview.port
215 This setting determines the default port of gerrit remote
216
217 gitreview.project
218 This setting determines the default name of gerrit git repo
219
220 gitreview.remote
221 This setting determines the default name to use for gerrit
222 remote
223
224 gitreview.branch
225 This setting determines the default branch
226
227 gitreview.track
228 Determines whether to prefer the currently-tracked branch
229 (if any) and the branch against which the changeset was
230 submitted to Gerrit (if there is exactly one such branch)
231 to the defaultremote and defaultbranch for submitting and
232 rebasing against. If the local topic branch is tracking a
233 remote branch, the remote and branch that the local topic
234 branch is tracking should be used for submit and rebase
235 operations, rather than the defaultremote and default‐
236 branch.
237
238 When downloading a patch, creates the local branch to track
239 the appropriate remote and branch in order to choose that
240 branch by default when submitting modifications to that
241 changeset.
242
243 A value of 'true' or 'false' should be specified.
244
245 true Do prefer the currently-tracked branch (if
246 any) - equivalent to setting --track when
247 submitting changes.
248
249 false Ignore tracking branches - equivalent to set‐
250 ting --no-track (the default) or providing an
251 explicit branch name when submitting changes.
252 This is the default value unless overridden
253 by .gitreview file, and is implied by provid‐
254 ing a specific branch name on the command
255 line.
256
257 gitreview.rebase
258 This setting determines whether changes submitted will be
259 rebased to the newest state of the branch.
260
261 A value of 'true' or 'false' should be specified.
262
263 false Do not rebase changes on submit - equivalent
264 to setting -R when submitting changes.
265
266 true Do rebase changes on submit. This is the
267 default value unless overridden by .gitreview
268 file.
269
270 This setting takes precedence over repository-specific con‐
271 figuration in the .gitreview file.
272
273 color.review Whether to use ANSI escape sequences to add color to the
274 output displayed by this command. Default value is deter‐
275 mined by color.ui.
276
277 auto or true If you want output to use color when written
278 to the terminal (default with Git 1.8.4 and
279 newer).
280
281 always If you want all output to use color
282
283 never or false
284 If you wish not to use color for any output.
285 (default with Git older than 1.8.4)
286
287 git-review will query git credential system for Gerrit user/password when
288 authentication failed over http(s). Unlike git, git-review does not per‐
289 sist Gerrit user/password in git credential system for security purposes
290 and git credential system configuration stays under user responsibility.
291
293 To use git-review with your project, it is recommended that you create a
294 file at the root of the repository named .gitreview and place information
295 about your Gerrit installation in it. The format is similar to the Win‐
296 dows .ini file format:
297
298 [gerrit]
299 host=hostname
300 port=TCP port number of gerrit
301 project=project name
302 defaultbranch=branch to work on
303
304 It is also possible to specify optional default name for the Git remote
305 using the defaultremote configuration parameter.
306
307 Setting defaultrebase to zero will make git-review not to rebase changes
308 by default (same as the -R command line option)
309
310 [gerrit]
311 scheme=ssh
312 host=review.example.com
313 port=29418
314 project=department/project.git
315 defaultbranch=master
316 defaultremote=review
317 defaultrebase=0
318 track=0
319
320 When the same option is provided through FILES and CONFIGURATION, the
321 CONFIGURATION value wins.
322
324 Normally, exit status is 0 if executed successfully. Exit status 1 indi‐
325 cates general error, sometimes more specific error codes are available:
326
327 2 Gerrit commit-msg hook could not be successfully installed.
328
329 3 Could not parse malformed argument value or user input.
330
331 32 Cannot fetch list of open changesets from Gerrit.
332
333 33 Cannot parse list of open changesets received from Gerrit.
334
335 34 Cannot query information about changesets.
336
337 35 Cannot fetch information about the changeset to be downloaded.
338
339 36 Changeset not found.
340
341 37 Particular patchset cannot be fetched from the remote git reposi‐
342 tory.
343
344 38 Specified patchset number not found in the changeset.
345
346 39 Invalid patchsets for comparison.
347
348 40 Connection to Gerrit was closed.
349
350 64 Cannot checkout downloaded patchset into the new branch.
351
352 65 Cannot checkout downloaded patchset into existing branch.
353
354 66 Cannot hard reset working directory and git index after download.
355
356 67 Cannot switch to some other branch when trying to finish the current
357 branch.
358
359 68 Cannot delete current branch.
360
361 69 Requested patchset cannot be fully applied to the current branch.
362 This exit status will be returned when there are merge conflicts
363 with the current branch. Possible reasons include an attempt to
364 apply patchset from the different branch or code. This exit status
365 will also be returned if the patchset is already applied to the cur‐
366 rent branch.
367
368 70 Cannot determine top level Git directory or .git subdirectory path.
369
370 101 Unauthorized (401) http request done by git-review.
371
372 104 Not Found (404) http request done by git-review.
373
374 Exit status larger than 31 indicates problem with communication with Ger‐
375 rit or remote Git repository, exit status larger than 63 means there was
376 a problem with a local repository or a working copy.
377
378 Exit status larger than or equal to 128 means internal error in running
379 the "git" command.
380
382 To fetch a remote change number 3004:
383
384 $ git-review -d 3004
385 Downloading refs/changes/04/3004/1 from gerrit into
386 review/someone/topic_name
387 Switched to branch 'review/someone/topic_name
388 $ git branch
389 master
390 * review/author/topic_name
391
392 Gerrit looks up both name of the author and the topic name from Gerrit to
393 name a local branch. This facilitates easier identification of changes.
394
395 To fetch a remote patchset number 5 from change number 3004:
396
397 $ git-review -d 3004,5
398 Downloading refs/changes/04/3004/5 from gerrit into
399 review/someone/topic_name-patch5
400 Switched to branch 'review/someone/topic_name-patch5
401 $ git branch
402 master
403 * review/author/topic_name-patch5
404
405 To send a change for review and delete local branch afterwards:
406
407 $ git-review -f
408 remote: Resolving deltas: 0% (0/8)
409 To ssh://username@review.example.com/department/project.git
410 * [new branch] HEAD -> refs/for/master/topic_name
411 Switched to branch 'master'
412 Deleted branch 'review/someone/topic_name'
413 $ git branch
414 * master
415
416 An example .gitreview configuration file for a project department/project
417 hosted on review.example.com port 29418 in the branch master :
418
419 [gerrit]
420 host=review.example.com
421 port=29418
422 project=department/project.git
423 defaultbranch=master
424
426 Bug reports can be submitted to
427 https://launchpad.net/git-review
428
430 git-review is maintained by OpenStack, LLC
431
432 This manpage has been enhanced by:
433 Antoine Musso <hashar@free.fr>
434 Marcin Cieslak <saper@saper.info>
435 Pavel Sedlák <psedlak@redhat.com>
436
437 June 12th, 2015