SlideShare a Scribd company logo
Code Matters -
Eclipse Hackers Git Guide
EclipseCon 2014
http://eclipse.org/jgit
http://eclipse.org/egit
http://code.google.com/p/gerrit
Stefan Lay
(SAP)
Lars Vogel
(vogella)
Christian Grail
(SAP)
Gerrit Code Review @ Eclipse
https://git.eclipse.org/r/ is activated for most projects
Case study: Contributing to Eclipse
● Create a user account
https://dev.eclipse.org/site_login/createaccount
.php
● Log into https://projects.eclipse.org/ and agree
to the Contributor License agreement
● Logon to the Gerrit Web UI at
https://git.eclipse.org/r/ using the email address
you registered with your Eclipse (and Bugzilla)
account and your Eclipse password.
● https://git.eclipse.org/r/#/settings/ and upload
your public SSH key
Agenda
Introduction
Exercises
Setup & Cloning the Sample Repository
Local Development with EGit
Gerrit Code Review
Contribution to Eclipse
Q & A
Git
Version Control
Distributed
Created 2005 for Linux Kernel development
Enables collaborative Workflows
Git at Eclipse
2010 2011 2012 2014
EGit and JGit
projects used
Git and Gerrit
Projects could
move to git Gerrit
available for
all projects
CVS support ended
2013
Development with Git
and Eclipse
Developer PC
Gerrit
git git
git
git
Developer PC
git
git
clone repository
Sample Application
Git Exercises
1 Setup & Clone the example repository
2 Develop a feature
3 Work on branches in parallel
4 Fetch the latest state
Copyright © S. Lay, M. Sohn
Git in a nutshell
Git Concepts: Storage
Git Concepts: Storage
Git Concepts: Commits
Git Concepts: Commits
Git Concepts: Branches
Git Concepts: Branches
Git Exercises
5 Merging, Rebasing, Resolving Conflicts
6 History view
7 Change a series of commits
8 Git blame
Gerrit code review
Originally developed by
Google for code review of the
Android OS project
Gerrit Code Review @ Eclipse
https://git.eclipse.org/r/ is activated for most projects
Contributions in Git
I fix Eclipse
Integration
repository
Contributor 1
Fetch/ Push
Git
Fetch
Contributions in Git
I fix Eclipse
Fetch/
Push
Reviews
Contributions either via patches or
commit rights
I don't know this guy,
he does not get
commit rights.
Committer
Fetch/
Push
Reviews
Reviewing patches
To much
work…
especially if
there is a
feedback loop
Committer
Rule #1 of good code
review - Make it easy!
Reviews must
be easy Contributions
must be
easy
Roles in a Gerrit project
● Contributor
● Reviewer
● Committer
● Admin
Review feedback
● -2 Blocks (committer only)
● -1 Please adjust
● 1 OK
● 2 Good to go (commiter only)
Integration
repository
Contributor 1
Contributor 2
Reviewer
Fetch/
Push
Fetch
Fetch/ Push
CI Build
Server
Fetch
Gerrit
Reviews
Fetch
Fetch
Approve +1
Suggestion to improve -1
Integration
repository
CI Build
Server
Fetch
Gerrit
Reviews
Approve +2
Committer
Rejects -2
Advantages of Gerrit
code review
● “Safe” to contribute
● Easy for all sides
● Feedback possible on a
line-by-line basis
● Great learning environment
One Commit == one Gerrit review
Gerrit review is identified via the
Change-ID in the commit message
Amend the commit and push the
changes to update the review
Dark side
of Gerrit
Comparison to Github
● Merge requests based on
branches
● Feels easier than reviews
based on commits
● But: Github review system not
as advanced as with Gerrit
Gerrit
Access Control
Gerrit
git push
Git Concepts: Pushing to Gerrit
Demo
Gerrit
Commenting
Gerrit
Discussing & Improving
Copyright © S. Lay, M. Sohn
Gerrit
Voting
Gerrit
Learn more:
Talk by Shawn Pearce (Gerrit founder and Project Lead)
and Ian Bull
Extending Gerrit: A Look at the Gerrit Plugin API
Tuesday, 10:30 to 11:05, Bayside
Gerrit Exercises
1 Configure push to Gerrit
2 Push change to Gerrit
3 Review change
4 Improve a change
5 Submit a change to the codebase
6 New Changescreen
7 View Gerrit review notes
Common
ancestor
Commit 3
origin/master
Gerrit issue #1 – non fast forward change
Commit 4
Gerrit review 2 Gerrit review 3
Commit 2
Commit A Commit B
origin/master
Solution issue #1 – Rebase
Commit 4
Gerrit review 2 Gerrit review 3
Commit A Commit B
More...
Commit 1 Commit 2 Commit 3
origin/master
Gerrit issue #2 – Push a
series of
unrelated changes
Commit 4
Gerrit review 1 Gerrit review 2 Gerrit review 3
Commit 1 Commit 2 Commit 3
origin/master
Gerrit issue #2 – Push a series of
unrelated changes
Commit 4
NO WAY THIS
GETS INTO OUR
CODE BASE!!!
Gerrit review 2 Gerrit review 3
Commit 1
Commit 2
Commit 3'
origin/master
Gerrit issue #2 – Solution
Commit 4'
git reset --hard origin/master
git cherrypick 4
Push again to Gerrit → new change set
Gerrit review 2 Gerrit review 3
Commit 1 Commit 2
origin/master
Gerrit issue #3 – Using the same Change-ID
in two commits
Commit 3
Change-ID I123 Change-ID I123
Change-ID I123
Commit 1 Commit 2
origin/master
Gerrit issue #3 – Solution: Squash
commits
Commit 3
Squash commits
Push again to Gerrit → new change set
Change-ID I123 Change-ID I123
Change-ID I123
Commit 2'
Change-ID I123
Changes from 2 and 3
Gerrit Code Review @ Eclipse
https://git.eclipse.org/r/ is activated for most projects
Case study: Contributing to Eclipse
● Create a user account
https://dev.eclipse.org/site_login/createaccount
.php
● Log into https://projects.eclipse.org/ and agree
to the Contributor License agreement
● Logon to the Gerrit Web UI at
https://git.eclipse.org/r/ using the email address
you registered with your Eclipse (and Bugzilla)
account and your Eclipse password.
● https://git.eclipse.org/r/#/settings/ and upload
your public SSH key
Q&A
Join us at the
EclipseCon Hackathon
and learn how to hack on JGit / EGit
Harbour - Tuesday, March 18, 2014 - 19:00 to 21:00
Evaluate This Session
Sign-in:
www.eclipsecon.org
Select session from schedule
Evaluate
:
1
2
3

More Related Content

Similar to The-Git-Tutorial.ppt.pptx

What's new in Gerrit Code Review v3.1 and beyond
What's new in Gerrit Code Review v3.1 and beyondWhat's new in Gerrit Code Review v3.1 and beyond
What's new in Gerrit Code Review v3.1 and beyond
Luca Milanesio
 
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
msohn
 
Git from the trenches
Git from the trenchesGit from the trenches
Git from the trenches
Nuno Caneco
 
3DC Intro to Git Workshop
3DC Intro to Git Workshop3DC Intro to Git Workshop
3DC Intro to Git Workshop
BeckhamWee
 
Git collaboration
Git collaborationGit collaboration
Git collaboration
Ivelin Yanev
 
GWT Contributor Workshop
GWT Contributor WorkshopGWT Contributor Workshop
GWT Contributor Workshop
Manuel Carrasco Moñino
 
Code review vs pull request
Code review vs pull requestCode review vs pull request
Code review vs pull request
Bryan Liu
 
Git, GitHub and Open Source
Git, GitHub and Open SourceGit, GitHub and Open Source
Git, GitHub and Open Source
Lorna Mitchell
 
Open Source_Git.pptx
Open Source_Git.pptxOpen Source_Git.pptx
Open Source_Git.pptx
Muhammad Sohail
 
Git
GitGit
git KT .pptx
git KT .pptxgit KT .pptx
git KT .pptx
sumit583388
 
Git training
Git trainingGit training
Git training
Jérémy Gobet
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
Nyros Technologies
 
Introduction to Git.pptx
Introduction to Git.pptxIntroduction to Git.pptx
Introduction to Git.pptx
gdscuds
 
Git Basics
Git BasicsGit Basics
Git Basics
Ryan Condron
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
JasleenSondhi
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践Terry Wang
 
git-docker.pdf
git-docker.pdfgit-docker.pdf
git-docker.pdf
NuttavutThongjor1
 

Similar to The-Git-Tutorial.ppt.pptx (20)

What's new in Gerrit Code Review v3.1 and beyond
What's new in Gerrit Code Review v3.1 and beyondWhat's new in Gerrit Code Review v3.1 and beyond
What's new in Gerrit Code Review v3.1 and beyond
 
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
Development with Git and Gerrit - Eclipse DemoCamp Stuttgart - 2010-11-23
 
Git from the trenches
Git from the trenchesGit from the trenches
Git from the trenches
 
3DC Intro to Git Workshop
3DC Intro to Git Workshop3DC Intro to Git Workshop
3DC Intro to Git Workshop
 
Git collaboration
Git collaborationGit collaboration
Git collaboration
 
GWT Contributor Workshop
GWT Contributor WorkshopGWT Contributor Workshop
GWT Contributor Workshop
 
Code review vs pull request
Code review vs pull requestCode review vs pull request
Code review vs pull request
 
Git, GitHub and Open Source
Git, GitHub and Open SourceGit, GitHub and Open Source
Git, GitHub and Open Source
 
Open Source_Git.pptx
Open Source_Git.pptxOpen Source_Git.pptx
Open Source_Git.pptx
 
Git
GitGit
Git
 
Geek git
Geek gitGeek git
Geek git
 
git KT .pptx
git KT .pptxgit KT .pptx
git KT .pptx
 
Git training
Git trainingGit training
Git training
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Introduction to Git.pptx
Introduction to Git.pptxIntroduction to Git.pptx
Introduction to Git.pptx
 
Git Basics
Git BasicsGit Basics
Git Basics
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践
 
git-docker.pdf
git-docker.pdfgit-docker.pdf
git-docker.pdf
 
Git
GitGit
Git
 

Recently uploaded

Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 

Recently uploaded (20)

Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 

The-Git-Tutorial.ppt.pptx