Git Tutorial EclipseCon France 2014 - Gerrit Exercise 5 - improve a change
1. Improve a Change
This exercise shows how to improve a change that didn’t pass the code review by submitting
another patch set. Each (new) patch set is another iterative improvement of the change. There
could be several rounds of improvements (new patch sets) until the change is ready to be
submitted to the code base.
Preparation
● There is a change that was reviewed and needs to be improved.
● Case-1: you are going to improve your own change.
● Case-2: you are going to improve a change started by someone else (who is not able to
continue working on that change for some reason).
Depending on which case you choose, follow Case-1 or Case-2 exercise. You may also try both
exercises.
Case-1: Checkout your feature branch where you
pushed the patch set 1 from
Make sure the feature branch is checked-out. If not double click the feature branch to check it
out.
Case-2: Fetch the latest patch set of the change you
want to improve
Note the numerical change ID of the change that need to be improved:
In this example the change ID is 4445.
In Eclipse right-click the Git repository node and select Fetch from Gerrit:
2. In the “Fetch a change from Gerrit” dialog enter the Change ID:
Press Ctrl-Space for auto-completion and choose the first item from the list by either pressing
the Enter or by double clicking the item:
3. Choose “Create and checkout a local branch” option and enter the local branch name if you
don’t like the default. For example you may name the local branch like “improve-divide-op” if you
are going to continue working on the change that provides the divide operation:
4. Improving the Change
From the web browser look at the change and read the comments written by the reviewer(s)
and start improving the source code from Eclipse.
When done with the improvements, commit the change. Make sure to choose Amend Previous
Commit in the staging view:
Don’t change the already existing Change-Id: footer! This will be used by Gerrit to determine
that you are pushing a new patch set for an already existing change.
Click Commit to commit your improvement in the local branch.
Push the next patch set
Right-click the Git repository node and select Push to Upstream command in order to push your
change to Gerrit:
A confirmation dialog pops-up and shows the URL of the change: