SlideShare a Scribd company logo
1 of 54
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 beyondLuca 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-23msohn
 
Git from the trenches
Git from the trenchesGit from the trenches
Git from the trenchesNuno Caneco
 
3DC Intro to Git Workshop
3DC Intro to Git Workshop3DC Intro to Git Workshop
3DC Intro to Git WorkshopBeckhamWee
 
Code review vs pull request
Code review vs pull requestCode review vs pull request
Code review vs pull requestBryan Liu
 
Git, GitHub and Open Source
Git, GitHub and Open SourceGit, GitHub and Open Source
Git, GitHub and Open SourceLorna Mitchell
 
Introduction to Git.pptx
Introduction to Git.pptxIntroduction to Git.pptx
Introduction to Git.pptxgdscuds
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hubJasleenSondhi
 
Git 入门 与 实践
Git 入门 与 实践Git 入门 与 实践
Git 入门 与 实践Terry Wang
 

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

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 

Recently uploaded (20)

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 

The-Git-Tutorial.ppt.pptx