There are three roles in the Gerrit Code Review system.
Project Owner – Repository Owner
Change Owner – developers who can submit changes
Reviewers – who reviews changes
1. For Project Owner, he/she needs to configure the project access permission.
On the Gerrit Web Page, click 'Projects' -> 'Access' -> 'Edit' , then you can modify the project access permission. You can add reviewer and submitter.
And for project owner, he/she should setup .gitreview file for the repository
>git clone your_git_repository
>cd your_git_repository_folder
>vi .gitreview
add following contents:
[gerrit]
host=your_gerrit_server
port=your_gerrit_server_port
project=your_project
defaultbranch=master
>git add .gitreview
>git commit
>git push origin master
2. For Change Owner, he/she can modify code, then commit , then start review
But before these operation, change owner need install git-review by apt system. And add gerrit as remote ref.
>sudo apt install git-review
>git clone your_git_repository
>git remote add gerrit your_git_repository
after you modify your file.
>git add your_modify_file
>git commit -m "your comments"
>git review
Then on the Gerrit Web Page, change owner can find the change(commit) on 'My' -> 'Changes' -> 'Outgoing reviews'.
Click the change , then change owner can choose reviewers.
After choose reviewers, change owner just need wait for the 'submit' button show up. When will it show up? After at least one reviewer score +2 to this change.
After the 'submit' button show up, change owner can click it to finally push the change to GIT repository.
3. For reviewers, he/she will find the change on 'My' -> 'Changes' -> 'Incoming reviews'.
Click the change, then reviewer can review the diff of this change. After review, reviewer needs to click 'reply' to input comments and score the change.
After click 'Post' button, reviewer finishes his/her job. Remember, change needs at least one +2 score to show 'submit' button on change owner web page.