SlideShare a Scribd company logo
Review a Change
In this exercise you will do a code review in Gerrit.
Preparation
● follow the exercise 2 to create an open change in Gerrit.
You can review your own change or a change created by somebody else.
In practice you will usually review changes created by other developers and others will review
your changes. Therefore, try to find a change (for egit-training) not created by you and use it for
this exercise.
A review of a simple change is usually done in the Gerrit UI. However, for a more complex
change you may want to fetch it into your local Git repository, build and test it and look at it in
Eclipse.
Review the source code changes from Gerrit
A change may consist of one or more patch sets. Each patch set corresponds to one Git
commit. Newer patchsets replace previous ones when the author reacts on review comments
by improving the previous patchset and creates a new commit using “commit amend” to replace
the previous commit. When a change has more than one patch set it is only necessary to review
the latest patch set since it’s the one replacing all previous ones within the same change ! This
is an important principle in Gerrit to remember.
Steps:
● Look at the list of files under the latest patch set (patch set 1 in this case). These are the
files that were added, modified or deleted within this change.
● click the Side-by-Side link of a file to open a page displaying the changes done in this
file. The left side shows the “old version” and the right side shows the “new version” of
the file. The diff is highlighted:
● Think about every change you see
● If you want to comment on a line just double click it and type in your
comment:
● Click Save in order to save the (draft of) your comment
○ NOTE: the comments you create are not yet visible to anybody else but you.
Only when you publish your comments they will become visible to everybody.
● Continue reviewing other files in the same way
Review the commit message
Providing a good commit message is as important as writing good code. A good commit
message should describe why (the motivation) and not what. When months or years later you
look at a change in your Git history you will easily see what was changed. However, only if the
commit message was good we will know why this change was made.
Therefore, Gerrit also provides review of the commit message. It is done the same way as
reviewing a file and the commit message appear at the top of the file list:
Vote and Publish Comments
● Click the “Up to Change” link to go back to the change screen
● Click the “Review” button
● Vote in the “Code Review” category
● Vote +1 in the “Verified” and the “IP Clean” categories. Normally, this is not done by the
code reviewer but we don’t have IP review for the egit-training project. If you are running
against http://git.eclipse.org/r/ the Verified vote will be done by a Hudson job which is
verifying all changes pushed for review.
● Write the cover message and click the “Publish Comments” button:
You are done with the review! Now the author of the change can read your comments and
provide an improved new patchset in the next review iteration.
The next chapter shows another possibility which is useful when reviewing more complex
changes:
Fetching the change into local repository
When a change is more complex you may want to fetch it into your local Git repository in order
to look at it from Eclipse. In that case you may build it locally, debug it etc...
To fetch a change first note the numerical change ID of it. Look at the URL of the change in the
web browser and locate the numerical Change ID:
In this case it is 4445.
In Eclipse right-click the Git repository node and select Fetch from Gerrit…:
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:
Choose “Checkout FETCH_HEAD”. This will checkout the fetched change but will not create
a local branch. This is enough if you are not going to contribute further modifications of the
change.
Now, you have the change checked out locally and your working tree reflects the state the
author of the change had when he committed this change.
Note that the code review and sharing a change happens before the change gets submitted
into the main code base.
Copyright © 2014 by C. Halstrick, E. Kempin, S. Lay, S. Zivkov, M. Sohn

More Related Content

PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 5 - improve a change
PDF
Git Tutorial EclipseCon France 2014 - Git Exercise 02 - develop a feature
PDF
Git Tutorial EclipseCon France 2014 - Git Exercise 04 - merging rebasing and ...
PPTX
How to commit a project in svn using svn plugin in anypoint studio
PPTX
GitFlow Workshop
PDF
Source code management with Git
PDF
201401217 potatotips no12-for_slideshare_english
PPTX
How to commit a project in svn using svn plugin in anypointstudio
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 5 - improve a change
Git Tutorial EclipseCon France 2014 - Git Exercise 02 - develop a feature
Git Tutorial EclipseCon France 2014 - Git Exercise 04 - merging rebasing and ...
How to commit a project in svn using svn plugin in anypoint studio
GitFlow Workshop
Source code management with Git
201401217 potatotips no12-for_slideshare_english
How to commit a project in svn using svn plugin in anypointstudio

What's hot (7)

PPT
New Features May 11 2009
PDF
Git the easy way
PDF
Advance workshop on git
PDF
Git Tutorial EclipseCon France 2014 - Git Exercise 03 - work on branches in p...
PPTX
Git flow workflow example
PDF
Contribute to CPython
PPTX
exe in MatLab
New Features May 11 2009
Git the easy way
Advance workshop on git
Git Tutorial EclipseCon France 2014 - Git Exercise 03 - work on branches in p...
Git flow workflow example
Contribute to CPython
exe in MatLab
Ad

Similar to Git Tutorial EclipseCon France 2014 - Gerrit Exercise 4 - review change (20)

PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 7 - new changescreen
PDF
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
PPTX
The-Git-Tutorial.ppt.pptx
PPTX
Git and Gerrit Code Review - Tech Talk - 2010_09_23
PDF
Gerrit Code Review
PPT
Eclipse Hacker's Guide to the Git Universe
PPTX
[Public] gerrit concepts and workflows
PDF
Learning Gerrit Code Review 1st Edition Milanesio
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 3 - push change to gerrit
PDF
Learning Gerrit Code Review 1st Edition Milanesio 2024 scribd download
PDF
Download ebooks file Learning Gerrit Code Review 1st Edition Milanesio all ch...
PDF
EGit and Gerrit Code Review - Eclipse DemoCamp Bonn - 2010-11-16
PDF
Review your code like a Googler
ODP
ESE 2010: Using Git in Eclipse
PDF
Gerrit tutorial
PDF
A Tutorial for GitHub.pdf
PDF
A Tutorial for GitHub.pdf
PDF
GWT Contributor Workshop
PDF
Using Git in Eclipse - Eclipse Summit Europe 2010-11-03
PDF
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 7 - new changescreen
Code Review with Git and Gerrit - Devoxx 2011 - Tools in Action - 2011-11-14
The-Git-Tutorial.ppt.pptx
Git and Gerrit Code Review - Tech Talk - 2010_09_23
Gerrit Code Review
Eclipse Hacker's Guide to the Git Universe
[Public] gerrit concepts and workflows
Learning Gerrit Code Review 1st Edition Milanesio
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 3 - push change to gerrit
Learning Gerrit Code Review 1st Edition Milanesio 2024 scribd download
Download ebooks file Learning Gerrit Code Review 1st Edition Milanesio all ch...
EGit and Gerrit Code Review - Eclipse DemoCamp Bonn - 2010-11-16
Review your code like a Googler
ESE 2010: Using Git in Eclipse
Gerrit tutorial
A Tutorial for GitHub.pdf
A Tutorial for GitHub.pdf
GWT Contributor Workshop
Using Git in Eclipse - Eclipse Summit Europe 2010-11-03
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
Ad

More from msohn (20)

PPTX
Project Gardener - EclipseCon Europe - 2018-10-23
PDF
News from Git in Eclipse - EclipseCon EU - 2016-10-26
PDF
Git journey from mars to neon EclipseCon North America - 2016-03-08
PDF
Versioning large binary files with JGit, EGit and Gerrit
PDF
News from Git in Eclipse - EclipseCon 2015 Europe
PPTX
Git missiontomars 2015-03-10
PPTX
News from EGit - Talk EclipseCon Europe 2014 - Ludwigsburg
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 9 - starting demo gerrit
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 6 - submit a change
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 2 - fetch the latest state
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 1 - configure for gerrit
PDF
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 8 - view gerrit review ...
PDF
Git Tutorial EclipseCon France 2014 - Git Exercise 07 - git blame
PDF
Git Tutorial EclipseCon France 2014 - Git Exercise 06 - interactive rebase
PDF
Git Tutorial EclipseCon France 2014 - Git Exercise 05 - history view
PDF
Git Tutorial EclipseCon France 2014 - Git Exercise 01 - installation and conf...
PDF
Code Matters - Eclipse Hackers Git Guide - EclipseCon France 2014
PPTX
Interactive Rebase with EGit
PDF
EGit 3.0 and beyond
PPTX
Cool new stuff in JGit and EGit - Eclipse Democamp Munich 2013-06-12
Project Gardener - EclipseCon Europe - 2018-10-23
News from Git in Eclipse - EclipseCon EU - 2016-10-26
Git journey from mars to neon EclipseCon North America - 2016-03-08
Versioning large binary files with JGit, EGit and Gerrit
News from Git in Eclipse - EclipseCon 2015 Europe
Git missiontomars 2015-03-10
News from EGit - Talk EclipseCon Europe 2014 - Ludwigsburg
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 9 - starting demo gerrit
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 6 - submit a change
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 2 - fetch the latest state
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 1 - configure for gerrit
Git Tutorial EclipseCon France 2014 - Gerrit Exercise 8 - view gerrit review ...
Git Tutorial EclipseCon France 2014 - Git Exercise 07 - git blame
Git Tutorial EclipseCon France 2014 - Git Exercise 06 - interactive rebase
Git Tutorial EclipseCon France 2014 - Git Exercise 05 - history view
Git Tutorial EclipseCon France 2014 - Git Exercise 01 - installation and conf...
Code Matters - Eclipse Hackers Git Guide - EclipseCon France 2014
Interactive Rebase with EGit
EGit 3.0 and beyond
Cool new stuff in JGit and EGit - Eclipse Democamp Munich 2013-06-12

Recently uploaded (20)

PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
top salesforce developer skills in 2025.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
System and Network Administration Chapter 2
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
AI in Product Development-omnex systems
PDF
medical staffing services at VALiNTRY
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Operating system designcfffgfgggggggvggggggggg
top salesforce developer skills in 2025.pdf
PTS Company Brochure 2025 (1).pdf.......
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Softaken Excel to vCard Converter Software.pdf
wealthsignaloriginal-com-DS-text-... (1).pdf
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Design an Analysis of Algorithms II-SECS-1021-03
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Digital Strategies for Manufacturing Companies
Understanding Forklifts - TECH EHS Solution
Internet Downloader Manager (IDM) Crack 6.42 Build 41
System and Network Administration Chapter 2
Reimagine Home Health with the Power of Agentic AI​
AI in Product Development-omnex systems
medical staffing services at VALiNTRY
Upgrade and Innovation Strategies for SAP ERP Customers
2025 Textile ERP Trends: SAP, Odoo & Oracle

Git Tutorial EclipseCon France 2014 - Gerrit Exercise 4 - review change

  • 1. Review a Change In this exercise you will do a code review in Gerrit. Preparation ● follow the exercise 2 to create an open change in Gerrit. You can review your own change or a change created by somebody else. In practice you will usually review changes created by other developers and others will review your changes. Therefore, try to find a change (for egit-training) not created by you and use it for this exercise. A review of a simple change is usually done in the Gerrit UI. However, for a more complex change you may want to fetch it into your local Git repository, build and test it and look at it in Eclipse. Review the source code changes from Gerrit A change may consist of one or more patch sets. Each patch set corresponds to one Git commit. Newer patchsets replace previous ones when the author reacts on review comments by improving the previous patchset and creates a new commit using “commit amend” to replace the previous commit. When a change has more than one patch set it is only necessary to review the latest patch set since it’s the one replacing all previous ones within the same change ! This is an important principle in Gerrit to remember. Steps: ● Look at the list of files under the latest patch set (patch set 1 in this case). These are the files that were added, modified or deleted within this change. ● click the Side-by-Side link of a file to open a page displaying the changes done in this file. The left side shows the “old version” and the right side shows the “new version” of the file. The diff is highlighted:
  • 2. ● Think about every change you see ● If you want to comment on a line just double click it and type in your comment: ● Click Save in order to save the (draft of) your comment ○ NOTE: the comments you create are not yet visible to anybody else but you. Only when you publish your comments they will become visible to everybody. ● Continue reviewing other files in the same way
  • 3. Review the commit message Providing a good commit message is as important as writing good code. A good commit message should describe why (the motivation) and not what. When months or years later you look at a change in your Git history you will easily see what was changed. However, only if the commit message was good we will know why this change was made. Therefore, Gerrit also provides review of the commit message. It is done the same way as reviewing a file and the commit message appear at the top of the file list: Vote and Publish Comments ● Click the “Up to Change” link to go back to the change screen ● Click the “Review” button ● Vote in the “Code Review” category
  • 4. ● Vote +1 in the “Verified” and the “IP Clean” categories. Normally, this is not done by the code reviewer but we don’t have IP review for the egit-training project. If you are running against http://git.eclipse.org/r/ the Verified vote will be done by a Hudson job which is verifying all changes pushed for review. ● Write the cover message and click the “Publish Comments” button: You are done with the review! Now the author of the change can read your comments and provide an improved new patchset in the next review iteration. The next chapter shows another possibility which is useful when reviewing more complex changes: Fetching the change into local repository When a change is more complex you may want to fetch it into your local Git repository in order to look at it from Eclipse. In that case you may build it locally, debug it etc... To fetch a change first note the numerical change ID of it. Look at the URL of the change in the web browser and locate the numerical Change ID: In this case it is 4445. In Eclipse right-click the Git repository node and select Fetch from Gerrit…:
  • 5. In the “Fetch a change from Gerrit” dialog enter the Change ID:
  • 6. 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: Choose “Checkout FETCH_HEAD”. This will checkout the fetched change but will not create a local branch. This is enough if you are not going to contribute further modifications of the change. Now, you have the change checked out locally and your working tree reflects the state the author of the change had when he committed this change. Note that the code review and sharing a change happens before the change gets submitted into the main code base. Copyright © 2014 by C. Halstrick, E. Kempin, S. Lay, S. Zivkov, M. Sohn