Mais conteúdo relacionado Semelhante a Understanding and Using Git at Eclipse (20) Mais de Chris Aniszczyk (20) Understanding and Using Git at Eclipse1. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn Understanding and Using Git at Eclipse Chris Aniszczyk (Red Hat) Shawn Pearce (Google) Robin Rosenberg (Dewire) Matthias Sohn (SAP) 3. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn Here's the Deal All of us want to see Git successful at Eclipse Git like any other DVCS has a bit of a learning curve This tutorial is made up of a brief introduction followed by some exercises on using Git, EGit and Gerrit 4. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn No Free Lunch The best way to learn Git is to use Git Please stop and ask us questions at anytime 5. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn A History Lesson 2005 Linus Torvalds starts Git 2006 Proof-of-concept, quite unusable 2007 Index reader, quickdiff 2008 Add history view, commit, push/fetch 2009 Moved to Eclipse.org 2010 Automatic IP Logs Diff/Merge Cleanup API Exit Incubation Release 1.0 7. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn What is Git? Distributed Version Control System (DVCS) Originally created for the Linux Kernel If you want comedy, watch Linus' talk at Google http://www.youtube.com/watch?v=4XpnKHJAok8 9. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn 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 10. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn How does it work? A DVCS 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 11. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn It's all about the changesets 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 Changesets contain pointers to the previous changeset 12. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn Branches The current version of your repository is simply a pointer to the end of the tree The 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 id Creating branches in a DVCS is fast, you simply point to a different element in the tree on disk already 13. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn Merging DVCSs are all about merging Given that each node in the changeset tree contains a pointer to its previous node (and transitively, to the beginning of time), it's much more powerful than the standard flat CVCS diff. In other words, not only do you know what changes need to be made, but also what point in history they need to be made . So, if you have a changeset which renames a file, and then merge in a changeset which points to the file as it was before it was renamed, then a CVCS will just fall over; but a DVCS will be able to apply the change before the rename occurred, and then play forward the changes. 14. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn Merging Merges are just the weaving together of two (or more) local branches into one However, unlike CVCS, you don't have to specify anything about where you're merging from and to; the trees automatically know what their split point was in the past, and can work it out from there. Merging is much easier in a DVCS like Git 16. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn Cloning and Remotes git clone git://egit.eclipse.org/egit.git Where you can push or pull to is configured on a per (local) repository basis git remote add github http://github.com/zx/myegit.git origin is the default remote; you can have many remotes 17. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn Git Internals Cryptographic signatures ... ensures data integrity Snapshot based ... saves whole project 18. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn Git Internals Cryptographic signatures ... ensures data integrity Snapshot based ... saves whole project History stored as graph ... accurate records 19. Exercises You're armed with the basics now 44. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and 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 Git is the future SCM of Eclipse 45. Understanding and Using Git at Eclipse | © 2010 by C. Aniszczyk, S. Pearce, R. Rosenberg and M. Sohn Resources Ask questions on the EGit/JGit forums http://git-scm.com/documentation is your friend Read the Pro Git book - http://progit.org/book/ Notas do Editor git config --global core.autocrlf false Commit as-is to be compatible with current EGIT Have pre-packaged Eclipses 3.5 for Mac, Windows and Linux on USB key Mention git mergetool and various conflict edtors xxdiff vimdiff kdiff3 emacsdiff beydondcompare Watch out for white space damage by certain MUAs