Gerrit/Alternatives to git-review

We use git-review to interact with Gerrit in our code review and contribution processes. If installing git-review is not feasible for you, you will use an alternate way to communicate with Gerrit.

First, you need to download the commit-msg hook script https://gerrit.wikimedia.org/r/tools/hooks/commit-msg and save itin the .git/hooks/ subdirectory of your cloned copy of the repository.

Note : .git starts with a dot, hence your operating system and tools may not show it by default.

1) With a browser:

Download the script from the repo using "Save As ..." then browse to wikimedia-git-repos/examples/.git/hooks/. Voilà!

2) With wget:

Change to the repository directory (for example,

3) With curl:

You also need to ensure the hook is executable. In Linux you do this with:

Whenever you commit a change locally, the hook script will generate a unique  for it and add it to the commit message.

Next, add an alias to simplify the command to push changes to Gerrit for review. You can do this by executing the following from your repository clone (for example, within ):

If you have a single 'origin' remote, then in the above comman replace 'gerrit' with 'origin':

(The refs/for/ is Gerrit magic and must not be omitted. However, you may adapt master to point to the remote branch that you want to commit to. E.g.: When trying to push to the remote branch Foo use refs/for/Foo.)

Push a commit to Gerrit with:

If you want to group a few related changesets (when working on a feature, or just to make them searchable in Gerrit), you can push them under the same topic using refs/for/Foo/topic, for example:

More details: the part about git push in https://gerrit.wikimedia.org/r/Documentation/user-upload.html.