BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Go Language Now Accepts Patches via GitHub Pull Requests

Go Language Now Accepts Patches via GitHub Pull Requests

Leia em Português

This item in japanese

Google has started mirroring GitHub PRs for Go into Gerrit, Go’s upstream Git server, thus making it easier for developers to contribute to Go development.

Gerrit is the main code management tool for Go development. To make Go code more easily available to developers, though, all changes merged into Gerrit are mirrored to GitHub GoLang repository. The Go team has recently started mirroring GitHub pull requests as well, with the aim of allowing a more typical workflow for contributing to Go development, writes Go Google engineer Andrew Bonventre.

This is made possible by GerritBot, a bot that will import any GitHub PR to Gerrit and post the link to the Gerrit review as a comment to the GitHub PR. All comments added in Gerrit will be synced back to the PR, so the original PR contributor can address them and push more commits to the same PR branch without ever leaving GitHub.

Gerrit is a web-based code review tool built on top of Git. It aims to make code review easier by providing a lightweight framework to show changes in a side-by-side display and by allowing inline comments. This is somewhat similar to what GitHub provides with Pull Requests (PR), albeit with a major underlying philosophical difference. Indeed, Gerrit performs reviews on a per-commit basis while GitHub PRs are based on differences between two branches. This has significant implications in terms of what workflows work more naturally in GitHub or Gerrit. Specifically, Gerrit focus on single-commit review means changes should be broken into small, self-contained commits, while it is usual for a GitHub PR to include several commits.

Additionally, Gerrit fosters a model where commits move through successive revisions, before being actually merged upstream, with the goal of carefully crafting the change history by amending earlier commits, or squashing multiple commits into one, etc. This may not be the most common use of GitHub PRs, especially not when using GitHub Web UI, although you could manually attain similar results when handling PRs using the command line.

Rate this Article

Adoption
Style

BT