GIT-REVIEW(1)
π NAME π
okay bestie, meet git-review β she takes your changes and submits them to Gerrit for review. π
that's it, that's the whole assignment, periodt.
β¨ SYNOPSIS β¨
here's how you actually call her, fr fr:
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 [branch]
git-review --version
πΈ DESCRIPTION πΈ
so git-review automates and streamlines some of the tasks involved with submitting local changes to a Gerrit server for review. she's literally designed to make it easier to comprehend Gerrit, especially for users that have recently switched to Git from another version control system. π«Ά no gatekeeping here, we've all been the new girl.
now about change, bestie, listen up: change can be changeNumber as obtained using the --list option, or it can be changeNumber,patchsetNumber for fetching the exact patchset from the change. π and when it's that second one? your local branch name will have a -patch[patchsetNumber] suffix. iconic, honestly.
π οΈ The following options are available
-d change,--download=changeβ download change from Gerrit straight into a local branch π«³ and that branch gets named after the change number. if the local branch already exists? she'll attempt to update it with the latest patchset for this change. slay.-x change,--cherrypick=changeβ apply change from Gerrit and commit it into the current local branch (a "cherry pick" π). no additional branch is created. this makes it possible to review a change without making a local branch for it. but on the other hand, be aware: if you're not careful, this can easily result in additional patchsets for dependent changes π. also, if the current branch is different enough, the change may not apply at all, or it may produce merge conflicts that you have to resolve by hand. not a vibe.-N change,--cherrypickonly=changeβ apply change from Gerrit into the current working directory, add it to the staging area (the "git index"), but do not commit it. this 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 it may produce merge conflicts that need to be resolved by hand.-X change,--cherrypickindicate=changeβ apply change from Gerrit and commit it into the current local branch (a "cherry pick"), and this time she indicates which commit this change was cherry-picked from. this 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 it may produce merge conflicts that need to be resolved by hand.-i,--new-changeidβ forcegit-reviewto generate a new Change-Id, even if one already exists in the changelog. β¨ fresh start energy.-m change-ps-range,--compare=change-ps-rangeβ download the specified patchsets for change from Gerrit, rebase both on master, and display the differences (git-diff). π
change-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 the diff will be displayed for the not-rebased branches. you can also use --no-rebase (-R) to always skip the test rebase, or --keep-rebase (-K) to keep the incomplete state rather than having it automatically aborted. π
-f,--finishβ close down the local branch and switch back to the target branch on successful submission. bye bestie, you ate. π-F,--force-rebaseβ force a rebase before doing anything else, even if it's not otherwise needed. unlike the normal test rebase, this rebase will be kept. use it if you know you want to push a commit automatically rebased onto the current state of the target branch. this is discouraged if you're amending an existing change, since it creates unnecessary additional differences from the previous revision and so makes things harder for reviewers of your changes. don't do your reviewers dirty like that. π€-n,--dry-runβ don't actually perform any commands that have direct effects. just print them instead. β¨ manifesting, but make it Git.-r remote,--remote=remoteβ the Git remote to use for Gerrit.--remote-hookβ when installing thecommit-msghook, fetch it from the remote rather than using the built-in version. π-s,--setupβ just run the repo setup commands but don't submit anything. lowkey the "get ready with me" option.-t topic,--topic=topicβ sets the target topic for this change on the Gerrit server.-T,--no-topicβ submit review without a topic (this is the default).--hashtags=taglistβ a comma-separated list of hashtag strings for this change. no spaces allowed. π--message=messageβ optional quoted message to include with the patchset. π¬-p,--privateβ send the patch as a private patch ready for review. Gerrit versions>= 2.15.-P,--remove-privateβ send a patch that is already in private state to normal patch. Gerrit versions>= 2.15.-w,--wip,--work-in-progressβ send the patch as work in progress, for Gerrit versions>= 2.15. π§ not done yet bestie, don't look.-W,--readyβ send a patch that's already work in progress as ready for review. Gerrit versions>= 2.15. β¨ the glow-up option.--cc reviewer ...β carbon copy one or more reviewers to the uploaded patchsets. reviewers should be identifiable by Gerrit (usually use their Gerrit username or email address). π§--reviewers reviewer ...β subscribe one or more reviewers to the uploaded patchsets. reviewers should be identifiable by Gerrit (usually use their Gerrit username or email address).--notify typeβ control to whom email notifications are sent. possible values areNONE,OWNER,OWNER_REVIEWERS,ALL(the last one is the default). π-u,--updateβ skip cached local copies and force updates from network resources. no stale data in this house.-l,--listβ list the available reviews on the Gerrit server for this project. ποΈ-y,--yesβ indicate that you do, in fact, understand, if you are submitting more than one patch. like, yes bestie, I know, I'm sure. π-v,--verboseβ turns on more verbose output. she will tell you everything and honestly? we love a transparent queen.-R,--no-rebaseβ don't test for possible merge conflicts with the target branch before pushing. if the test rebase detects no merge conflicts, then the rebase is undone and your previous state is pushed. if merge conflicts are detected,git-reviewexits with the rebase in progress, allowing you to address it manually. by defaultgit-reviewwill never push the results of a rebase without your explicit involvement. π
use this option to skip the merge conflict test, allowing you to push merge conflicts. yes, that means conflicts can go up. you've been warned.
also can be used for --compare to skip automatic rebase of fetched reviews.
-K,--keep-rebaseβ if the test rebase before pushing fails, keep the incomplete rebase state in the worktree rather than automatically aborting it to clean up. π«Ά you get to keep the mess and deal with it yourself.--no-thinβ disable thin pushes when pushing to Gerrit. this should only be used if you are currently experiencing unpack failures due to missing trees. it should not be required in typical day to day use. fr fr, don't touch this unless you have to.--color always|never|autoβ enable or disable color output. default is"auto". π¨--no-colorβ same thing as--color=never. π--no-custom-scriptβ do not run scripts installed ashooks/{action}-review, where action is one of"pre"or"post". π«--trackβ choose the branch to submit the change against (and, if rebasing, to rebase against) from the branch being tracked (if a branch is being tracked), and set the tracking branch when downloading a change to point to the remote and branch against which patches should be submitted. see thegitreview.trackconfiguration. π±--no-trackβ ignore any branch being tracked by the current branch, overridinggitreview.track. this option is implied by providing a specific branch name on the command line.--use-pushurlβ use thepushurloption for theoriginremote rather than conventional separate Gerrit remotes. π--licenseβ print the license text and exit. π--versionβ print the version number and exit. β--helpβ print the short help message and exit. πββοΈ bestie needs a little help sometimes and that's okay.
βοΈ CONFIGURATION β¨
bestie, you can tune this whole utility by dropping entries into your Git config. yep, that's it. here's every single key that's supported π
gitreview.username π«Ά
the default username used to access the repository. if it's not specified in the Git configuration, the Git remote, or the .gitreview file, then the user is gonna get prompted to type in the username. no cap.
example entry in the .gitconfig file:
[gitreview]
username=mygerrituser
gitreview.scheme π
this setting decides the default scheme (ssh/http/https) of the gerrit remote.
gitreview.host πΈ
this setting decides the default hostname of the gerrit remote.
gitreview.port π
this setting decides the default port of the gerrit remote.
gitreview.project π
this setting decides the default name of the gerrit git repo.
gitreview.remote π¦
this setting decides the default name to use for the gerrit remote.
gitreview.branch β
this setting decides the default branch.
gitreview.notopic π
set to true to never submit with a default topic (deprecated). this is the default behavior and this option has no effect β it's literally just vibing there for backwards compatability and may be removed in a future version of git-review.
so yeah, don't bother, it does nothing. iconic but useless π
gitreview.track π₯
this one decides whether to prefer the currently-tracked branch (if there is one) and the branch against which the changeset was submitted to Gerrit (if there's exactly one such branch) over the defaultremote and defaultbranch for submitting and rebasing against. so if your local topic branch is tracking a remote branch, then the remote and branch that the local topic branch is tracking should be used for submit and rebase operations instead of defaultremote and defaultbranch. periodt.
when downloading a patch, it creates the local branch to track the appropriate remote and branch, so that branch gets chosen by default when you're submitting modifications to that changeset.
you should specify a value of true or false.
trueβ do prefer the currently-tracked branch (if any) β equivalent to setting--trackwhen submitting changes.falseβ ignore tracking branches β equivalent to setting--no-track(the default) or providing an explicit branch name when submitting changes. this is the default value unless it's overridden by the.gitreviewfile, and it's implied by providing a specific branch name on the command line.
gitreview.usepushurl π
this setting decides whether to use a separate Git remote for the Gerrit connection, or to set pushurl on the remote origin.
you should specify a value of true or false.
falseβ do not usepushurland instead use a separate remote.trueβ usepushurlfor interacting with Gerrit.
gitreview.rebase π§
this setting decides whether changes submitted will be rebased to the newest state of the branch.
you should specify a value of true or false.
falseβ do not rebase changes on submit β equivalent to setting-Rwhen submitting changes.trueβ do rebase changes on submit. this is the default value unless overridden by the.gitreviewfile.
this setting takes precedence over repository-specific configuration in the .gitreview file. so it wins the argument, as it should π
gitreview.branchauthor π
this setting changes the look of the author part when naming the local branch of a downloaded change. the value must be one of "name", "email", or "username". default is "name". see also the --download option.
color.review π
whether to use ANSI escape sequences to add color to the output displayed by this command. the default value is determined by color.ui.
autoortrueβ if you want output to use color when written to the terminal (default with Git 1.8.4 and newer).alwaysβ if you want all output to use color.neverorfalseβ if you wish not to use color for any output. (default with Git older than 1.8.4)
git-review will query the git credential system for the Gerrit user/password when authentication failed over http(s). unlike git, git-review does not persist the Gerrit user/password in the git credential system, for security purposes, and the git credential system configuration stays under user responsibility. so like, that part is on you bestie π«Ά
π FILES πΈ
to use git-review with your project, it's recommended that you create a file at the root of the repository named .gitreview and place info 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's also possible to specify an optional default name for the Git remote using the defaultremote configuration parameter.
setting defaultrebase to zero will make git-review not 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. no debate π
π©Ί DIAGNOSTICS π
normally, exit status is 0 if executed successfully. exit status 1 indicates a general error, and sometimes more specific error codes are available:
2β Gerritcommit-msghook could not be successfully installed.3β could not parse malformed argument value or user input.32β cannot fetch list of open changesets from Gerrit.33β cannot parse list of open changesets received from Gerrit.34β cannot query information about changesets.35β cannot fetch information about the changeset to be downloaded.36β changeset not found.37β particular patchset cannot be fetched from the remote git repository.38β specified patchset number not found in the changeset.39β invalid patchsets for comparison.40β connection to Gerrit was closed.64β cannot checkout downloaded patchset into the new branch.65β cannot checkout downloaded patchset into existing branch.66β cannot hard reset working directory and git index after download.67β cannot switch to some other branch when trying to finish the current branch.68β cannot delete current branch.69β requested patchset cannot be fully applied to the current branch. this exit status gets returned when there are merge conflicts with the current branch. possible reasons include an attempt to apply a patchset from a different branch or code. this exit status will also be returned if the patchset is already applied to the current branch. π70β cannot determine top level Git directory or.gitsubdirectory path.101β unauthorized (401) http request done bygit-review.104β not found (404) http request done bygit-review.
exit status larger than 31 indicates a problem with communication with Gerrit or the 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.
π§ͺ EXAMPLES π₯
to fetch a remote change number 3004:
$ git-review -d 3004
Downloading refs/changes/04/3004/1 from gerrit into
review/3004
Switched to branch 'review/3004
$ git branch
master
* review/3004
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/3004-patch5
Switched to branch 'review/3004-patch5
$ git branch
master
* review/3004-patch5
to send a change for review and delete the 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
Switched to branch 'master'
Deleted branch 'review/somenumber'
$ 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
π BUGS π
bug reports can be submitted to https://storyboard.openstack.org/#!/project/opendev/git-review
π AUTHORS β¨
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>
and that's the whole page bestie, you ate that π the version that got stamped on this one is 2021-02-09 and it answers to the name GIT-REVIEW(1) π go forth and review, you're the main character now π
π¦ where this page comes from
- alpine 3.24: git-review-doc 2.5.0-r2 Β· Apache-2.0
- epel 10: git-review 2.5.0-2.el10_3 Β· Apache-2.0
- fedora 43: git-review 2.5.0-2.fc43 Β· Apache-2.0
- fedora 44: git-review 2.5.0-2.fc44 Β· Apache-2.0
- nixpkgs unstable: git-review 2.5.0
- ubuntu resolute: git-review 2.5.0-1 Β· Apache-2.0
- ubuntu stonking: git-review 2.5.0-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms