|
| 1 | +--- |
| 2 | +title: Gerrit Mode |
| 3 | +description: Use Gerrit mode in GitButler to have a simple and powerful client for the Gerrit code review system |
| 4 | +--- |
| 5 | + |
| 6 | +Not _everyone_ uses GitHub or GitLab to review code and collaborate. If you use the [Gerrit](https://www.gerritcodereview.com/) code review tool, GitButler has a mode for you! In fact, GitButler is the best Gerrit client there is. |
| 7 | + |
| 8 | +## What is Gerrit |
| 9 | + |
| 10 | +If you've never heard of Gerrit, it's used by large teams like the Android or Chrome projects to manage huge numbers of changes and users across large numbers of interdependent repositories. |
| 11 | + |
| 12 | +Here is an example of incoming changesets on the [Android project](https://android-review.googlesource.com/q/status:open+-is:wip,50): |
| 13 | + |
| 14 | +<ImageSection |
| 15 | + className="mx-auto" |
| 16 | + src="https://gitbutler-docs-images-public.s3.us-east-1.amazonaws.com/CleanShot%202025-10-17%20at%2016.03.44%402x.png" |
| 17 | + width="800" |
| 18 | + height="600" |
| 19 | + subtitle="The Android project's Gerrit code review" |
| 20 | +/> |
| 21 | + |
| 22 | +## How is Gerrit different than Pull/Merge Requests? |
| 23 | + |
| 24 | +Good question. With GitHub or GitLab, when you send a pull/merge request, the review process is branch based. If you add more commits on top of your branch, the changes are squished into one big unified diff for review. Most teams tend to avoid rebasing anything that was already shared. |
| 25 | + |
| 26 | +Gerrit is a commit based review system. Every review is based on exactly one commit. It's very common to edit shared commits and submit new versions of them to address feedback. |
| 27 | + |
| 28 | +This model works _very well_ with GitButler's easy [commit editing](/features/branch-management/commits) features. With any other Git client, interactive rebasing and amending tends to be quite painful and error prone, making it fairly difficult to work with Gerrit's model. With GitButler, it's ideal. Just drag and drop changes and update your changesets easily. |
| 29 | + |
| 30 | +## How to turn on Gerrit Mode |
| 31 | + |
| 32 | +To turn on Gerrit Mode in GitButler, you just have to set a Git config option called `gitbutler.gerritMode` in the project you want to act in a Gerrit compatible fashion: |
| 33 | + |
| 34 | +``` |
| 35 | +❯ cd my_project |
| 36 | +❯ git config gitbutler.gerritMode 1 |
| 37 | +``` |
| 38 | + |
| 39 | +## What is Gerrit Mode |
| 40 | + |
| 41 | +Now GitButler will change it's behavior in the following ways: |
| 42 | + |
| 43 | +- When you commit, we will automatically inject a `Change-Id` trailer into the commit in the format that Gerrit expects. You do not need to [setup a `commit-msg` hook](https://gerrit-review.googlesource.com/Documentation/cmd-hook-commit-msg.html) like you do with other Git clients. |
| 44 | +- When you push, it will not push to a matching branch name on the remote. Instead it will push to `refs/for/main` (or whatever the name of the target branch is set to be). |
| 45 | +- After a push, we record the change url and show you the link and number for each commit automatically. |
| 46 | + |
| 47 | +<ImageSection |
| 48 | + className="mx-auto" |
| 49 | + src="https://gitbutler-docs-images-public.s3.us-east-1.amazonaws.com/CleanShot%202025-10-17%20at%2016.21.06%402x.png" |
| 50 | + width="800" |
| 51 | + height="600" |
| 52 | + subtitle="Gerrit Change numbers and URLs are shown and linked to" |
| 53 | +/> |
| 54 | + |
| 55 | +We can also set some extra push options when we push, including: |
| 56 | + |
| 57 | +- [Topics](https://gerrit-review.googlesource.com/Documentation/cross-repository-changes.html) |
| 58 | +- [Hashtags](https://gerrit-review.googlesource.com/Documentation/intro-user.html#hashtags) |
| 59 | +- [WIP status](https://gerrit-review.googlesource.com/Documentation/intro-user.html#wip) |
| 60 | + |
| 61 | +<ImageSection |
| 62 | + className="mx-auto" |
| 63 | + src="https://gitbutler-docs-images-public.s3.us-east-1.amazonaws.com/CleanShot%202025-10-17%20at%2016.50.07%402x.png" |
| 64 | + width="800" |
| 65 | + height="600" |
| 66 | + subtitle="Set a topic, hashtag or wip status on push" |
| 67 | +/> |
0 commit comments