GIT-REVIEW(1) | General Commands Manual | GIT-REVIEW(1) |
git-review
—
Submit changes to Gerrit for review
git-review |
[-r remote]
[-uv ] -d
change [branch] |
git-review |
[-r remote]
[-uv ] -x
change [branch] |
git-review |
[-r remote]
[-uv ] -N
change [branch] |
git-review |
[-r remote]
[-uv ] -X
change [branch] |
git-review |
[-r remote]
[-uv ] -m
change-ps-range [branch] |
git-review |
[-r remote]
[-fnuv ] -s
[branch] |
git-review |
[-fnuvDRT ] [-r
remote] [-t
topic] [--reviewers
reviewer ...] [--notify
type] [branch] |
git-review |
-l |
git-review |
--version |
git-review
automates and streamlines some
of the tasks involved with submitting local changes to a Gerrit server for
review. It is designed to make it easier to comprehend Gerrit, especially
for users that have recently switched to Git from another version control
system.
change can be
changeNumber as obtained using
--list
option, or it can be
changeNumber,patchsetNumber for fetching exact
patchset from the change. In that case local branch name will have a
-patch[patchsetNumber] suffix.
The following options are available:
-d
change,
--download=
change-x
change,
--cherrypick=
changeThis makes it possible to review a change without creating a local branch for it. On the other hand, be aware: if you are not careful, this can easily result in additional patch sets for dependent changes. Also, if the current branch is different enough, the change may not apply at all or produce merge conflicts that need to be resolved by hand.
-N
change,
--cherrypickonly=
changeThis makes it possible to review a change without creating a local commit for it. Useful if you want to merge several commits into one that will be submitted for review.
If the current branch is different enough, the change may not apply at all or produce merge conflicts that need to be resolved by hand.
-X
change,
--cherrypickindicate=
changeThis makes it possible to re-review a change for a different branch without creating a local branch for it.
If the current branch is different enough, the change may not apply at all or produce merge conflicts that need to be resolved by hand.
-i
,
--new-changeid
-m
change-ps-range,
--compare=
change-ps-rangechange-ps-range can be specified as changeNumber,oldPatchSetNumber[-newPatchSetNumber]
oldPatchSetNumber is mandatory, and if newPatchSetNumber is not specified, the latest patchset will be used.
This makes it possible to easily compare what has changed from last time you reviewed the proposed change.
If the master branch is different enough, the rebase can produce merge conflicts. If that happens rebasing will be aborted and diff displayed for not-rebased branches. You can also use --no-rebase (-R) to always skip rebasing.
-f
,
--finish
-F
,
--force-rebase
-n
,
--dry-run
-r
remote,
--remote=
remote-s
,
--setup
-t
topic,
--topic=
topic-T
,
--no-topic
-p
,
--private
-P
,
--remove-private
-w
,
--work-in-progress
-W
,
--ready
--reviewers
reviewer ...--notify
type-u
,
--update
-l
,
--list
-y
,
--yes
-v
,
--verbose
-R
,
--no-rebase
When submitting a change for review, you will usually want it to be based on the tip of upstream branch in order to avoid possible conflicts. When amending a change and rebasing the new patchset, the Gerrit web interface will show a difference between the two patchsets which contains all commits in between. This may confuse many reviewers that would expect to see a much simpler difference.
Also can be used for --compare
to skip
automatic rebase of fetched reviews.
--no-thin
--color
always|never|auto--no-color
--no-custom-script
--track
--no-track
--use-pushurl
--license
--version
--help
This utility can be configured by adding entries to Git configuration.
The following configuration keys are supported:
Example entry in the .gitconfig file:
[gitreview] username=mygerrituser
When downloading a patch, creates the local branch to track the appropriate remote and branch in order to choose that branch by default when submitting modifications to that changeset.
A value of 'true' or 'false' should be specified.
--track
when submitting changes.--no-track
(the default) or providing an
explicit branch name when submitting changes. This is the default
value unless overridden by .gitreview file,
and is implied by providing a specific branch name on the command
line.A value of 'true' or 'false' should be specified.
A value of 'true' or 'false' should be specified.
-R
when submitting changes.This setting takes precedence over repository-specific configuration in the .gitreview file.
--download
option.git-review
will query git credential
system for Gerrit user/password when authentication failed over http(s).
Unlike git, git-review
does not persist Gerrit
user/password in git credential system for security purposes and git
credential system configuration stays under user responsibility.
To use git-review
with your project, it is
recommended that you create a file at the root of the repository named
.gitreview and place information about your Gerrit
installation in it. The format is similar to the Windows .ini file
format:
[gerrit] host=hostname port=TCP port number of gerrit project=project name defaultbranch=branch to work on
It is also possible to specify optional default name for the Git
remote using the defaultremote
configuration
parameter.
Setting defaultrebase
to zero will make
git-review
not to rebase changes by default (same as
the -R
command line option)
[gerrit] scheme=ssh host=review.example.com port=29418 project=department/project.git defaultbranch=master defaultremote=review defaultrebase=0 track=0
When the same option is provided through FILES and CONFIGURATION, the CONFIGURATION value wins.
Normally, exit status is 0 if executed successfully. Exit status 1 indicates general error, sometimes more specific error codes are available:
Exit status larger than 31 indicates problem with communication with Gerrit or remote Git repository, exit status larger than 63 means there was a problem with a local repository or a working copy.
Exit status larger than or equal to 128 means internal error in running the "git" command.
To fetch a remote change number 3004:
$ git-review -d 3004 Downloading refs/changes/04/3004/1 from gerrit into review/someone/topic_name Switched to branch 'review/someone/topic_name $ git branch master * review/author/topic_name
Gerrit looks up both name of the author and the topic name from Gerrit to name a local branch. This facilitates easier identification of changes.
To fetch a remote patchset number 5 from change number 3004:
$ git-review -d 3004,5 Downloading refs/changes/04/3004/5 from gerrit into review/someone/topic_name-patch5 Switched to branch 'review/someone/topic_name-patch5 $ git branch master * review/author/topic_name-patch5
To send a change for review and delete local branch afterwards:
$ git-review -f remote: Resolving deltas: 0% (0/8) To ssh://username@review.example.com/department/project.git * [new branch] HEAD -> refs/for/master/topic_name Switched to branch 'master' Deleted branch 'review/someone/topic_name' $ git branch * master
An example .gitreview configuration file
for a project department/project hosted on
review.example.com
port
29418
in the branch master
:
[gerrit] host=review.example.com port=29418 project=department/project.git defaultbranch=master
Bug reports can be submitted to https://storyboard.openstack.org/#!/project/opendev/git-review
git-review
is maintained by
OpenDev Contributors
This manpage has been enhanced by:
Antoine Musso ⟨hashar@free.fr⟩
Jeremy Stanley ⟨fungi@yuggoth.org⟩
Marcin Cieslak ⟨saper@saper.info⟩
Pavel Sedlák
⟨psedlak@redhat.com⟩
2021-02-09 |