blob: c09fec3dfce0fcb4e45543457e023990d4b2c01a [file] [log] [blame]
== Submit a Change to the Codebase
This exercise shows how to submit a change to the codebase. To be
submitable a change must have successfully passed the code review,
which means that:
* it got at least one highest possible vote in all voting categories
* and that there are no veto votes on any of the voting categories
=== Preparation
* follow the gerrit exercises link:push-a-change-to-gerrit.html[Push a
Change to Gerrit] and link:review-a-change.html[Review a Change] to
create and review a change
* you may also complete the gerrit exercise
link:improve-a-change.html[Improve a Change], but it is not
mandatory
* make sure your change has highest votes in all review categories and
that there are no veto votings in any of the voting categories
=== Submitting the change
To submit a change click the 'Submit Patch Set n' button on the change
screen in the Gerrit WebUI:
image:submit.png[Submit]
There are 3 possible outcomes of the Submit action:
==== 1. The change is merged successfully
If the change merges without any conflicts you will see that the
status of the change changed to 'Merged'.
image:merged.png[Merged]
==== 2. The change is submitted but the merge is pending
If the status changed to 'Submitted, Merge Pending' then the change
depends on another change that is still open (in review). In that case
the change will be merged automatically once all its dependencies are
submitted and merged.
==== 3. The submit fails due to merge conflicts
It may also happen that the submit fails due to merge conflicts. In
that case you will have to resolve the merge conflicts in your local
branch and then push another patch set. The steps are:
* Fetch the upstream. This updates the local 'origin/master' branch to
its latest state. Follow the git exercise
link:../git/fetch-the-latest-state-from-upstream.html[Fetch the
Latest State from Upstream].
* Rebase your feature branch to the 'origin/master'. Follow the git
exercise
link:../git/merge-rebase-and-resolving-conflicts.html#rebase[
Merge, Rebase and Resolving Conflicts (section Rebase)]. You will
get conflicts.
* Follow git exercise
link:../git/merge-rebase-and-resolving-conflicts.html#resolve-conflicts[
Merge, Rebase and Resolving Conflicts (section Resolve Merge
Conflicts)] to resolve the conflicts.
* Commit using the 'amend' option as described in the gerrit exercise
link:improve-a-change.html[Improve a Change].
* Push to the upstream as described in gerrit exercise
link:push-a-change-to-gerrit.html[Push a Change to Gerrit].
* After that a new patch set is created for this change. The new patch
set has again to pass the code review as shown in the gerrit
exercise link:review-a-change.html[Review a Change].
* Submit the change again once it passes the code review
link:index.html[Gerrit Exercises]