Gerrit Change Sets

Greg Foster
Greg Foster
Graphite software engineer

Change Sets, often referred to as 'changes,' are the heart of Gerrit's code review process. Each Change Set encapsulates a single coherent change to the codebase that is proposed by a contributor.

  • Atomic Commit Grouping: A Change Set groups related commits that collectively implement a single feature or fix a specific bug.

  • Unique Identifier: Each Change Set is given a unique Change-Id, which is used to track the set through its lifecycle.

  • Push to Refs/For: Contributors create Change Sets by pushing commits to a special refs/for namespace, which Gerrit interprets as a review request.

  • Change Set Ownership: The original author of the Change Set is typically its owner, responsible for addressing review feedback.

The journey of a Change Set from creation to merging is an iterative process that involves several stages:

  • Collaborative Review: Change Sets are subjected to line-by-line scrutiny from peers, with inline comments and discussions.

  • Iterative Development: Authors update Change Sets by pushing new patch sets in response to feedback until approval is reached.

  • Automated Testing: Change Sets can be configured to trigger automated tests, ensuring code quality and functionality before merging.

  • Manual Testing: Reviewers can pull Change Sets to their local environments for further testing if necessary.

  • Code Review Scores: Change Sets must receive positive scores from authorized reviewers to be considered for merging.

  • Mergeability Check: Gerrit checks if the Change Set can be merged without conflicts before allowing integration into the codebase.

Change Sets in Gerrit offer several benefits that enhance the code review process:

  • Focused Reviews: By encapsulating a specific change, reviewers can concentrate on understanding and evaluating just that change, rather than an entire branch of work.

  • Clear History: Each Change Set represents a logical unit of work, which leads to a cleaner, more understandable commit history.

  • Continuous Integration: The iterative nature of Change Sets aligns well with continuous integration practices, allowing for regular testing and review of small changes.

To maximize the effectiveness of Gerrit's Change Sets, certain best practices can be followed:

  • Small, Atomic Changes: Keeping Change Sets small and focused on a single concern makes reviews more manageable and effective.

  • Clear Commit Messages: Writing clear and descriptive commit messages helps reviewers understand the context and purpose of the changes.

  • Frequent Synchronization: Regularly syncing Change Sets with the target branch can prevent merge conflicts and reduce integration challenges.

Change Sets are a fundamental concept within Gerrit that promote a disciplined and efficient approach to code review. By fostering detailed scrutiny of every change and facilitating continuous integration, Change Sets help maintain high standards of code quality and project coherence. With Gerrit's Change Sets, teams can ensure that every piece of code is reviewed and tested thoroughly before it becomes part of the codebase.

Stay unblocked. Ship faster.
Experience the new developer workflow - create, review, and merge code continuously. Get started with one command.
Get started

Give your PR workflow
an upgrade today

Stack easier | Ship smaller | Review quicker

Or install our CLI.
Product Screenshot 1
Product Screenshot 2