How to use Gerrit to store changes before releasing for review

 Polishing Box  Comments Off on How to use Gerrit to store changes before releasing for review
Aug 302024
 

Before Gerrit 2.15 drafts of reviews were allowed to be checked in. There are many reasons to want to do this, including:

  • implementing only part of a change, but want to push your change to the server to run tests before requesting reviewer feedback
  • getting some of your team to review the change before the formal review starts
  • seeing what the change looks like before the formal review starts
  • backing up your code to work on something else without creating a branch

https://www.gerritcodereview.com/2.15.html#new-workflows documents that draft changes are replaced by 2 distinct features:

  1.  Work-in-Progress changes
    • Work-in-Progress (WIP) changes are visible to anyone but do not notify or require action from a reviewer.
    • Set WIP: git push origin HEAD:refs/for/master%wip
    • Remove WIP: git push origin HEAD:refs/for/master%ready
  2.  Private changes 
    • Private changes are changes that are only visible to their owners, reviewers, and users with the View Private Changes global capability. 
    • Set private: git push origin HEAD:refs/for/master%private
    • Remove private: git push origin HEAD:refs/for/master%remove-private

e.g. trying #2 you will get the URL as normal and it then shows private once accessed:

A change can be both private and WIP, they’re separate statuses.