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 a commit-msg hook script and place it in the right directory in your cloned copy of the repository. The script is available from https://gerrit.wikimedia.org/r/tools/hooks/commit-msg and must be placed in the repository sub directory .git/hooks/

NOTE : .git is a hidden folder

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:

When ever you commit a change locally, the hook script will generate a unique Change-Id for you.

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: