eclipse hackers guide to the git universe - eclipse democamp vienna 2011-12-02

18
Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn Eclipse Hacker’s Guide to the Git Universe Developing with EGit and Friends http://eclipse.org/jgit http://eclipse.org/egit http://code.google.com/p/ gerrit Matthias Sohn (SAP)matthias.sohn@ sap.com twitter: @masohn kground photo courtesy of NASA http://www.nasa.gov/multimedia/guidelines/index.html

Upload: msohn

Post on 10-Nov-2014

1.162 views

Category:

Technology


0 download

DESCRIPTION

Presentation held at Eclipse democamp Vienna on 2012-12-02

TRANSCRIPT

Page 1: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Eclipse Hacker’sGuide to the Git UniverseDeveloping with EGit and Friends

http://eclipse.org/jgithttp://eclipse.org/egit

http://code.google.com/p/gerrit

Matthias Sohn(SAP)[email protected]: @masohn

background photo courtesy of NASA http://www.nasa.gov/multimedia/guidelines/index.html

Page 2: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Git… a distributed revision control system built by the Linux project to facilitate code review

Distributed means no central repository• No central authority!• Easy offline usage• Easy to branch a project• Protected against manipulation by cryptographic hashes

Really good at merging• Coordination only needed "after the fact”• Easier to rejoin (or refresh) branches

Structured around commits (i.e. patches)• Tools for identifying problem commits (git bisect)• Tools for restructuring branches w/ specific commits

Page 3: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Git is mature and popular

… Git is widely used and is the most popular distributed version control system

Page 4: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Git use is growing

http://aniszczyk.org/2011/11/23/apache-and-politics-over-code/

Google trend search in US:

Page 5: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

History Git @ Eclipse

2005 Linus Torvalds starts Git

2006 Shawn Pearce starts JGit

2009 Eclipse decides on Git as replacement for CVS/SVNJGit/EGit move to eclipse.org, SAP joins

3/2010 EGit 0.7 (first release at Eclipse) 

9/2011 EGit 1.1 (Indigo SR1)

12/2011 Eclipse Git adoption:EGit 1.2Gerrit hosted by Eclipse

12/2012 Eclipse will retire CVS

Page 6: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Why did Eclipse move?

Git increases developer productivity

Git makes collaboration easier

Gerrit Review is great for Contributors

Github is the most popular coding platform

Page 7: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Git in Java

JGit is a lightweight Java library implementing Git • http://www.eclipse.org/jgit/

EGit is an Eclipse Team provider for Git based on JGit• http://www.eclipse.org/egit/

Gerrit Code Review is a Git server based on JGit • permissions and review workflow• http://code.google.com/p/gerrit

Gitblit is a Git server based on JGit• browsing (like GitWeb), statistics and RSS feeds• http://code.google.com/p/gitblit/

Page 8: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Github

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

• Became largest Forge• Free for public repositories

• EGit has GitHub connector

Page 9: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Modern Code Review – What is it ? When one developer writes code, another

developer is asked to review that code

A careful line-by-line critique

Happens in a non-threatening context

Goal is cooperation, not fault-finding

Integral part of coding process

Otherwise this will happen: Debugging someone else's broken code – Involuntary code review: Not so good; emotions may flare

Guido van Rossum [1]

[1] http://code.google.com/p/rietveld/downloads/detail?name=Mondrian2006.pdf

Page 10: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Code Review – Benefits

Four eyes catch more bugso Catch bugs early to save hours of debugging

Mentoring of new developers / contributorso Learn from mistakes without breaking stuff

Establish trust relationships o Prepare for more delegation

Good alternative to pair programmingo asynchronous and across locations

Coding standardso Keep overall readability & code quality high

Guido van Rossum [1]

[1] http://code.google.com/p/rietveld/downloads/detail?name=Mondrian2006.pdf

Page 11: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Developer PC

gitgit

Gerrit

git gitgitgit

push improved change 10

Developer PC

gitgit

fetch change 23 to try it

master

change 12

change 10

change 23

submit accepted change 12

fetch master to get updates

Gerrit Code Review

Page 12: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Integration with EGit

Gerrit is a Git server o any Git implementation can work with Gerrit

EGit simplifies work with Gerrito fetching a changeo automatic "push to Gerrit" configuration

Mylyn Reviews has a Gerrit connector

Page 13: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Gerrit - Workflow

Page 14: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Gerrit Review UI

http://egit.eclipse.org/r/#change,825

Page 15: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Gerrit – Eclipse Integration

Mylyn Gerrit Connector

• Task list integration

• Review editor,inline comments

• Publishing reviews

• EGit integration for fetching changes in review

Page 16: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

DEMO

Page 17: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Conclusion

DVCS like Git are powerful

Git supports convenient branching and merging

Git is very fast and scales well

Gerrit enables a nice code review workflow

Code review rocks !

Page 18: Eclipse Hackers Guide to the Git Universe - Eclipse democamp Vienna 2011-12-02

Eclipse Hacker’s Guide to the Git Universe | © 2011 by M. Sohn

Q & A