Gerrit Code Review
by Noah Hartmann
Short Answer:
- "Code Review based Git-System"
- requires a Code Review before merging the pushed code
What is Gerrit?
More Specific Answer:
- Git Server
- free, web-based, team-oriented
- provides a full code review system
- provides access control on git repositories
What is Gerrit?
About the Code-Review System
- Gerrit allows to review commits before they are integrated into a target branch
- Code Review is optional
- But required by default
- Possible to grant special access rights for direct push
What can you keep from this presentation?
- Importance of reviewing code
- best way to integrate it into your daily work life
- How Gerrit can help you with that...
- How to set up & how to use Gerrit
Gerrit - Workflow
1. Make a change
changed code
commit & push
specific repository
Gerrit - Workflow
2. Set up the review
- Go to your change on your gerrit website
- Add Reviewers
Gerrit - Workflow
3. Others review your code
4. Rework your code according to the reviews

- +2 Looks good to me, approved
- +1 Looks good to me, but someone else must approve
- 0 No score
- -1 I would prefer that you didn’t submit this
- -2 Do not submit
Gerrit - Workflow
5. Verify the change

+1
-1
Senior Dev
Gerrit - Workflow
6. Submit


Submit Type: Merge
Submit Type: Rebase
Note: Those submit types only take effect if there is a new untreated commit
Gerrit - Workflow
- Making the change
- Creating the review
- Others review your code
- Rework code according to review
- Verify
- Submit
Gerrit - Why Code Review?
To detect defects and fix them immediately. For Example:
- Compilation Errors
- Duplicate code (e.g. Methods which already exist)
-
Insufficient error condition handling
- enhance error handling to make it more robust
-
Too few tests
- more tests to prevent a bug from regressing
-
Outdated tests
- adapt tests to reflect changed behavior
- Messy Code
- Insufficient commit message
Gerrit - Facts
History:
- As Version Control System for the development of Android
- Based on similar Framework of Google named "Mondrian"
- First Name was "Rietveld", but later forked to Gerrit
- Name comes from popular Architect "Gerrit Rietveld"


Gerrit - Facts
Who works with Gerrit:
- Android
- Chromium OS
- Eclipse Foundation
- Google Fuchsia
- Garmin
- Go (programming language)
- Volvo Cars
- LibreOffice
- OpenStack
Gerrit - Pros/ Cons
| Pro | Contra |
|---|
- Great Code Review System
- Provides Integration with Jenkins
- Free & Open Source
- Unlimited Repository Support
-
No easy access
- Either deploy it yourself
- Or Log in to a public instance
- It's sometimes a bit restricting
- Only useful for min. 3 Person Teams
- (Merge-) Conflicts are not easy to fix
How can you work with Gerrit?
Public Deployment of Gerrit: gerrithub.io
How to get started: Tutorial in My ReadMe.md
Alternatives to Gerrit reviewboard.org
Phabricator (pre / post commit review)
Hands On!
Gerrit - Code Review
By sirhrtmn
Gerrit - Code Review
- 71