User:Dan-nl/Git and Gerrit/The Workflow

tl;dr

 * The initial  and   of a branch will create a change set in gerrit. Note the difference between the   command for the change set vs. the patch set.


 * Subsequent s and  s will create patchsets.

Gerrit & Git
Gerrit implements a different perspective on commits than git. In general :

Gerrit In Gerrit, each commit is considered a Change-Set that needs to be reviewed before possibly being merged into the master branch. These Change-Sets most likely depend on each other in order for the code to work properly, yet each Change-Set needs to be approved before all of them can be merged into the master branch. Because of this approach, you typically create one Change-Set and modify it by amending commits to it, which create Patch-Sets for that Change-Set. These Patch-Sets can then be approved or discarded. Once all of the Patch-Sets of a Change-Set have been approved, or discarded if necessary, the Change-Set can then be merged into the master branch if final approval by the core team is given.

Git In Git, each commit is an atomic change that does not need to be reviewed, but continuously contributes to the completion of a development branch. Once work on the development branch is completed, it may then be merged, in its entirety, into the master branch if approved by your team.

Update master
Make sure that your master branch (the branch created when you initially cloned the repository) is up to date:

Create a new change set
First, create a local branch for your new change. The branch name should be short, but reasonably descriptive. For example, if you are working on a bug, include its id, "bug/12345", this will show-up in gerrit as a topic of the master branch. The following command, run locally in your master branch directory, will create a new branch from ‘master’ and check it out for you.

Merge with master
If you are the primary author/maintainer of the code and the code has not yet been deployed to the Wikimedia cluster, you can merge the branch with the master branch by reviewing the branch in Gerrit with +2 and verifying with +2; otherwise, someone from the foundation will need to do that for you.

Working on an existing change set
Sometimes you want to work on a change set started by some else and then upload your changes as a new patch set.