If you are first time in Gerrit Code Review here we will take a short tour and look (in more details)
how to start contributing to any projects (or perform labs), make code review or place comments in
Gerrit Code Review of
NOTE: In order to start contributing to any projects, make code review or place comments in Gerrit Code Review of
ci.csn.khai.eduyou must have an account in
Sign in with your
@student.csn.khai.edu account in Gerrit Code Review:
Go to your personal (profile) Settings page:
Username and then click
'Select Username' button.
NOTE: Please, note that
Usernamecannot be changed, so set it very carefully according to the following rule: first letter of your name + your surname (see your email account as an example), e.g.
Vitalii Kulanov (vkulanov),
Andrey Popov (apopov).
If there is a need you can also modify your
'Contact information' (e.g. if your fullname is not displayed correctly
due to encoding problem) in
Add your personal SSH Public Key in account from
SSH Public Keys' menu.
NOTE: You can find some additional information about SSH and how to configure SSH key pair in “Connecting to GitHub with SSH” on GitHub.
If you need to customize some other preferences (Gerrit theme, data/time format etc.)
check the rest items of
Now you are ready to contribute to any project in
Gerrit Code Review of
NOTE: Before start contributing you have to be sure that
Gerrit/git-reviewis already installed and properly configured in your OS. Some basic examples about how to configure Git in Windows and install git-review (Gerrit) in Windows.
NOTE: The rest examples in this chapter is performed for Ubuntu 16.04.2 LTS
If you are a beginner it is strongly recommended to start your work with playground project
'cicsnkhaiedu-dev/sandbox' project. Select
'List' menu item from top bar menu,
List', type the name of the project in the
'Filter' field and select it.
'cicsnkhaiedu-dev/sandbox' project to your system. Click on
'ssh' menu item and copy
highlighted code line:
git clone ssh://firstname.lastname@example.org:29418/cicsnkhaiedu-dev/sandbox
Paste copied code to the terminal window and execute it:
machin@machin:/tmp/projects$ git clone ssh://email@example.com:29418/cicsnkhaiedu-dev/sandbox Cloning into 'sandbox'... remote: Counting objects: 3, done remote: Finding sources: 100% (3/3) remote: Total 3 (delta 0), reused 3 (delta 0) Receiving objects: 100% (3/3), done. Checking connectivity... done. machin@machin:/tmp/projects$ ls sandbox machin@machin:/tmp/projects$ tree . . └── sandbox └── README.md 1 directory, 1 file
As you can see cloned
sandbox project contains single
README.mdfile with your favourite Text Editor.
Check for changes in your local repository executing
git status command:
machin@machin:/tmp/projects/sandbox$ git status On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: README.md no changes added to commit (use "git add" and/or "git commit -a")
You can see the exact changes that took place (differences between current branch and remote
git diff origin/master:
machin@machin:/tmp/projects/sandbox$ git diff origin/master diff --git a/README.md b/README.md index dad16bd..b7731c4 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ # Hello from sandbox + +This is a change
Add file contents to the index executing
git add command:
machin@machin:/tmp/projects/sandbox$ git add README.md machin@machin:/tmp/projects/sandbox$ git status On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: README.md
Record (commit) changes to the repository executing
git commit command:
NOTE: See documentation on Git Commit Good Practice
Here is a small example of commit message:
Add small changes to README.md file This is the first commit to 'sandbox' project # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch master # Your branch is up-to-date with 'origin/master'. # # Changes to be committed: # modified: README.md #
And the result of
git commit command execution is following:
[master 53d83e2] Add small changes to README.md file 1 file changed, 2 insertions(+) machin@machin:/tmp/sandbox$ git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working directory clean
Send all changes on review to Gerrit Code Review executing
git review command
NOTE: If you do this first time the system will ask your
machin@machin:/tmp/sandbox$ git review Creating a git remote called "gerrit" that maps to: ssh://firstname.lastname@example.org:29418/cicsnkhaiedu-dev/sandbox Your change was committed before the commit hook was installed. Amending the commit to add a gerrit change id. remote: Processing changes: new: 1, refs: 1, done remote: remote: New Changes: remote: https://ci.csn.khai.edu/gerrit/2 Add small changes to README.md file remote: To ssh://email@example.com:29418/cicsnkhaiedu-dev/sandbox * [new branch] HEAD -> refs/publish/master
You can check (Top bar menu
Outgoing reviews), that newly added patch set
was created and ready for review:
NOTE: Commit message header of a patch set is displayed as a title in Gerrit Review System