Your SlideShare is downloading. ×
0
Using Git in Eclipse                                      http://eclipse.org/egitChris Aniszczyk (Red Hat)zx@redhat.comhtt...
About MeIve been using and hacking Eclipse for nearly a decadeEclipse Board of Directors, Committer RepresentativeMember i...
OutlineGit, EGit and JGitGit Concepts- Demo of EGitCode Review at EclipseGerritConclusion     Using Git in Eclipse | © 201...
Software Trends and Revolution Most major open source projects use some form of DVCS Git, Hg, Bazaar Linux X.org MySQL Ope...
Git … a distributed revision control system built by the Linux project to automate patch workflow Distributed means no cen...
Projects using Git … Git is widely used and is the most popular distributed version control system       Using Git in Ecli...
Git at Eclipse Eclipse defined a roadmap to move to Git in 2009 CVS is deprecated; SVN will be deprecated in the future EG...
Git at Eclipse EGit and JGit developed at http://egit.eclipse.org http://git.eclipse.org/ hosts live Eclipse Git repos Vir...
History of JGit and EGit2005   Linus Torvalds starts Git2006   Shawn Pearce starts JGit2009   Eclipse decides for Git Road...
Features EGit 0.10                                                                            ** planned for 0.10, * plann...
Learning Git – Theres no free lunch!… the purpose of this presentation isnt to teach you Git,you have to do that yourself!...
Git Resources http://git-scm.com/documentation is your friend Watch Linus talk at Google http://www.youtube.com/watch?v=4X...
OutlineGit, EGit and JGitGit ConceptsCode Review and EclipseGerritConclusion     Using Git in Eclipse | © 2010 by C. Anisz...
Centralized VCS Examples? CVS and SVN There is one Master repository where code is shared Everyone checks out their code (...
Distributed VCS Examples? Git and Hg Each user has a full local copy of the repository Forks happen, deal with it There is...
How does it work? A DVCS like Git generally operates at the level of a changeset Logically, a repository is made up from a...
Its all about the changesets  Changesets contain pointers to the previous changeset  previous: 48b2179994d494485b79504e8b5...
BranchesThe current version of your repository is simply a pointerto the end of the treeThe default "trunk" in Git is call...
MergingDVCS are all about mergingMerges are just the weaving together of two (or more)local branches into oneHowever, unli...
Pulling and Pushing Weve not talked about the distributed nature of DVCS Changes flow between repositories by push and pul...
Cloning and Remotesgit clone git://egit.eclipse.org/egit.gitWhere you can push or pull to is configured on a per(local) re...
Demo: A tour of EGit      Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
What is Peer Code Review?                                                                     Guido van Rossum [1]When one...
Code Review – Benefits                                                 Guido van Rossum [1]Four eyes catch more bugs     ...
Code Review atEclipse ?   Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
Eclipse - RolesCommitter   Formally elected   Can commit own changes without reviewContributor    Small changes          r...
Code Review via Bugzilla     Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
Eclipse – Review ProcessContributors  • create patch using CVS, SVN, Git (since 2009)  • attach patch to bug in BugzillaCo...
Eclipse – Review ProcessReview not done for all changesEach Eclipse.org project does it differentlyReview tedious for cont...
OutlineGit, EGit and JgitGit ConceptsCode Review and EclipseGerritConclusion     Using Git in Eclipse | © 2010 by C. Anisz...
Gerrit Code Review Gerrit is a Code Review system based on JGit   http://code.google.com/p/gerrit/    Also serves as a git...
History: Google and code review tools Mondrian (Guido van Rossum)   •   based on Perforce, Google infrastructure   •   Goo...
One Branch per Feature Master branch contains only reviewed and  approved changes     • master moves from good to better s...
Gerrit – Lifecycle of a Change                          •                            create local topic topic             ...
Gerrit – Lifecycle of a Change                               •                                 create local topic topic   ...
Gerrit – Lifecycle of a Change                            •                              create local topic               ...
Gerrit Workflow      Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
Gerrit     Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn   http://egit.eclipse.org/r/ - change,825
Code Review – Our ExperienceReview all changes!Review takes time (1 day … weeks)Implies parallel workflowEvery team member...
OutlineGit, EGit and JgitGit ConceptsCode Review and EclipseGerritConclusion     Using Git in Eclipse | © 2010 by C. Anisz...
ConclusionEGit and JGit are evolving quicklyGerrit enables a nice code review workflowGit supports convenient branching an...
Upcoming SlideShare
Loading in...5
×

Using git in eclipse by Chris Aniszczyk

2,199

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,199
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
56
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Using git in eclipse by Chris Aniszczyk"

  1. 1. Using Git in Eclipse http://eclipse.org/egitChris Aniszczyk (Red Hat)zx@redhat.comhttp://aniszczyk.org
  2. 2. About MeIve been using and hacking Eclipse for nearly a decadeEclipse Board of Directors, Committer RepresentativeMember in the Eclipse Architecture CouncilI like to run! (just finished Chicago marathon in 3:20)Co-author of RCP Book (www.eclipsercp.org) Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  3. 3. OutlineGit, EGit and JGitGit Concepts- Demo of EGitCode Review at EclipseGerritConclusion Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  4. 4. Software Trends and Revolution Most major open source projects use some form of DVCS Git, Hg, Bazaar Linux X.org MySQL OpenJDK Android JQuery Gnome Fedora Bugzilla and so on... Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  5. 5. Git … a distributed revision control system built by the Linux project to automate patch workflow Distributed means no central repository •No central authority! •Easy offline usage •Easy to fork a project •Protected against manipulation by cryptographic hashes Really good at merging •Coordination only needed "after the fact” •Easier to rejoin (or refresh) forked projects Structured around commits (i.e. patches) •Integrates with email channel •Tools for identifying problem commits (git bisect) •Tools for restructuring branches w/ specific commits Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  6. 6. Projects using Git … Git is widely used and is the most popular distributed version control system Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  7. 7. Git at Eclipse Eclipse defined a roadmap to move to Git in 2009 CVS is deprecated; SVN will be deprecated in the future EGit is an Eclipse Team provider for Git http://www.eclipse.org/egit/ JGit is a lightweight Java library implementing Git http://www.eclipse.org/jgit/ The goal is to build an Eclipse community around Git EGit and JGit are still beta and we want to establish a feedback loop to improve the tooling Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  8. 8. Git at Eclipse EGit and JGit developed at http://egit.eclipse.org http://git.eclipse.org/ hosts live Eclipse Git repos Virgo, Mylyn Review, ECF, SWTBot … http://dev.eclipse.org/git/index.html git mirrors for CVS Read-only copies kept up-to-date Can clone with git:// or http:// Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  9. 9. History of JGit and EGit2005 Linus Torvalds starts Git2006 Shawn Pearce starts JGit2009 Eclipse decides for Git Roadmap JGit/EGit move to eclipse.org SAP joins JGit/EGit3/2010 Released 0.7 (first release at Eclipse) Diff/Merge Algorithms, Automatic IP Logs6/2010 Released 0.8 (Helios) Usability Improvements, Git Repositories View, Tagging9/2010 Released 0.9 (Helios SR1) Merge, Synchronize View, .gitignorePlanned: 12/2010 0.10 (Helios SR2) 3/2011 0.11 6/2011 1.0 (Indigo) Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  10. 10. Features EGit 0.10 ** planned for 0.10, * planned for 0.11 supported, partial, missing, irrelevant for EGit git-add git-add git-format-patch git-format-patch git-shortlog git-shortlog git-relink git-relink git-rev-parse git-rev-parse git-am git-am git-gc git-gc git-show git-show git-remote git-remote git-show-branch git-show-branch git-archive git-archive git-grep git-grep git-stash git-stash git-repack git-repack git-verify-tag git-verify-tag git-bisect git-bisect git-init git-init git-status git-status git-replace git-replace git-whatchanged git-whatchanged git-branch git-branch git-log git-log git-submodule git-submodule git-annotate git-annotate git-bundle git-bundle * git-merge * git-merge * git-tag * git-tag * * git-blame git-blame .gitignore .gitignore git-checkout git-checkout git-mv git-mv git-config git-config git-cherry git-cherry git daemon git daemongit-cherry-pick git-cherry-pick git-notes git-notes git-fast-export git-fast-export git-count-objects git-count-objects Visual merge tool Visual merge tool git-clean git-clean git-pull git-pull git-fast-import git-fast-import git-difftool git-difftool ** HTTP support ** HTTP support git-clone git-clone git-push git-push git-filter-branch git-filter-branch git-fsck git-fsck * * Mylyn integration Mylyn integration git-commit git-commit ** git-rebase ** git-rebase git-mergetool git-mergetool git-get-tar-commit-id git-get-tar-commit-id * * Staging View Staging View git-describe git-describe git-reset git-reset git-pack-refs git-pack-refs git-help git-help * * Synchronize View Synchronize View git-diff git-diff git-revert git-revert git-prune git-prune git-merge-tree git-merge-tree History View History View git-fetch git-fetch git-rm git-rm git-reflog git-reflog git-rerere git-rerere Repositories View Repositories View
  11. 11. Learning Git – Theres no free lunch!… the purpose of this presentation isnt to teach you Git,you have to do that yourself! Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  12. 12. Git Resources http://git-scm.com/documentation is your friend Watch Linus talk at Google http://www.youtube.com/watch?v=4XpnKHJAok8 Read the Pro Git book - http://progit.org/book/ Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  13. 13. OutlineGit, EGit and JGitGit ConceptsCode Review and EclipseGerritConclusion Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  14. 14. Centralized VCS Examples? CVS and SVN There is one Master repository where code is shared Everyone checks out their code (or branch) from that repository, and checks changes back in Two major problems • You need to be on-line to perform actions • Patches go stale They are generally terrible, antiquated Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn
  15. 15. Distributed VCS Examples? Git and Hg Each user has a full local copy of the repository Forks happen, deal with it There is no real master repository like in a CVCS Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn
  16. 16. How does it work? A DVCS like Git generally operates at the level of a changeset Logically, a repository is made up from an initial empty state, followed by many changesets Changesets are identified by a SHA-1 hash value e.g., 0878a8189e6a3ae1ded86d9e9c7cbe3f Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn
  17. 17. Its all about the changesets Changesets contain pointers to the previous changeset previous: 48b2179994d494485b79504e8b5a6b23ce24a026 --- a/README.txt +++ b/README.txt @@ -1 +1 @@ -SVN is great +Git is great previous: 6ff60e964245816221414736d7e5fe6972246ead --- a/README.txt +++ b/README.txt @@ -1 +1 @@ -Git is great +SVN is great Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn
  18. 18. BranchesThe current version of your repository is simply a pointerto the end of the treeThe default "trunk" in Git is called "master"The tip of the current branch is called "HEAD"Any branch can be referred to by its hash idCreating branches in a DVCS is fast, you simply point toa different element in the tree on disk already Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn
  19. 19. MergingDVCS are all about mergingMerges are just the weaving together of two (or more)local branches into oneHowever, unlike CVCS, you dont have to specifyanything about where youre merging from and to; thetrees automatically know what their split point was in thepast, and can work it out from there.Merging is much easier in a DVCS like Git Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn
  20. 20. Pulling and Pushing Weve not talked about the distributed nature of DVCS Changes flow between repositories by push and pull Since a DVCS tree is merely a pointer to a branch... Theres three cases to consider for comparing two trees: • Your tip is an ancestor of my tip • My tip is an ancestor of your tip • Neither of our tips are direct ancestors; however, we both share a common ancestor Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn
  21. 21. Cloning and Remotesgit clone git://egit.eclipse.org/egit.gitWhere you can push or pull to is configured on a per(local) repository basisgit remote add github http://github.com/zx/myegit.gitorigin is the default remote; you can have many remotes Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn
  22. 22. Demo: A tour of EGit Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  23. 23. What is Peer Code Review? Guido van Rossum [1]When one developer writes code, another developeris asked to review that codeA careful line-by-line critiqueHappens in a non-threatening contextGoal is cooperation, not fault-findingOften an integral part of coding processDebugging someone elses broken code– Involuntary code review: Not so good; emotions may flare [1] http://code.google.com/p/rietveld/downloads/detail?name=Mondrian2006.pdf Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  24. 24. Code Review – Benefits Guido van Rossum [1]Four eyes catch more bugs  Catch bugs early to save hours of debuggingEnforce coding standards  Keep overall readability & code quality highMentoring of new developers  Learn from mistakes without breaking stuffEstablish trust relationships  Prepare for more delegationGood alternative to pair programming  asynchronous and across locations [1] http://code.google.com/p/rietveld/downloads/detail?name=Mondrian2006.pdf Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  25. 25. Code Review atEclipse ? Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  26. 26. Eclipse - RolesCommitter Formally elected Can commit own changes without reviewContributor Small changes reviewed by committers Bigger changes also formal IP review by legal team in separate protected Bugzilla (IPZilla)Review Tool patches attached to bug in Bugzilla comments in Bugzilla Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  27. 27. Code Review via Bugzilla Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  28. 28. Eclipse – Review ProcessContributors • create patch using CVS, SVN, Git (since 2009) • attach patch to bug in BugzillaCommitters • do code and IP review • comment, vote in Bugzilla • create CQ for changes needing IP review • commit accepted changesIP Team • does IP review bigger changes from contributors Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  29. 29. Eclipse – Review ProcessReview not done for all changesEach Eclipse.org project does it differentlyReview tedious for contributors(and also for committers mentoring contributors) Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  30. 30. OutlineGit, EGit and JgitGit ConceptsCode Review and EclipseGerritConclusion Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  31. 31. Gerrit Code Review Gerrit is a Code Review system based on JGit http://code.google.com/p/gerrit/ Also serves as a git server adding access control and workflow Used by • Android https://review.source.android.com/ • JGit, EGit http://egit.eclipse.org/r/ • Google, SAP, … Eclipse wants to use it … Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  32. 32. History: Google and code review tools Mondrian (Guido van Rossum) • based on Perforce, Google infrastructure • Google proprietary Rietvield (Guido van Rossum) • based on Subversion • Open Source hosted on GoogleApp Engine Gerrit (Shawn Pearce) • started as a fork of Rietvield • based on JGit and GWT • Open Source (Android) • Apache 2 license Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  33. 33. One Branch per Feature Master branch contains only reviewed and approved changes • master moves from good to better state after each (approved) change Each feature branch is based on the Master branch • stable starting point A change can really be abandoned because • no other approved change can depend on a not yet approved change • Gerrit will automatically reject a successor change of an abandoned change Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  34. 34. Gerrit – Lifecycle of a Change • create local topic topic branch master • commit change 1 • push it for review a • do review • automated verification Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  35. 35. Gerrit – Lifecycle of a Change • create local topic topic branch master • commit change • push it for review 1 • do review • automated a verification topic master c • refine based on 3 review • push new patchsets b 2 until review votes ok 1 a Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  36. 36. Gerrit – Lifecycle of a Change • create local topic master topic branch master • commit change • push it for review d topic 1 • do review a • automated verification c 3 b topic master 2 c • refine based on a 1 3 review • push new patchsets b until review votes ok 2 • Submit may lead to server-side merge 1 a • or merge / rebase before push Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  37. 37. Gerrit Workflow Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  38. 38. Gerrit Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn http://egit.eclipse.org/r/ - change,825
  39. 39. Code Review – Our ExperienceReview all changes!Review takes time (1 day … weeks)Implies parallel workflowEvery team member should do reviews regularlyAuthors have to wait for the review to happenGit & Gerrit help a lot here Code Review | © 2010 by M. Sohn
  40. 40. OutlineGit, EGit and JgitGit ConceptsCode Review and EclipseGerritConclusion Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  41. 41. ConclusionEGit and JGit are evolving quicklyGerrit enables a nice code review workflowGit supports convenient branching and mergingGit is very fast and scales wellEclipse and major other OS projects are moving to GitOpen source has embraced the way of DVCS Using Git in Eclipse | © 2010 by C. Aniszczyk and M. Sohn
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×