Git vs Subversion: ¿Cuando elegir uno u otro?


Published on

Javahispano y Paradigma Tecnológico organizan un un seminario sobre una comparativa de sistemas de versionado: Subversion vs. Git.
Seminario presentado por Mariano Navas el 29 de Mayo de 2013 en UPM.

Dentro del mundo de los sistemas de control de versiones tenemos dos grandes grupos: los centralizados y los distribuidos. Subversion es en buena medida el representante más notable en el grupo de los centralizados. En los distribuidos git se está imponiendo como la tendencia.
Más información sobre el seminario:
Vídeo youtube:
¿Quieres saber más?

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Git vs Subversion: ¿Cuando elegir uno u otro?

  1. 1. GIT VS. SVNWhich one should we use and when?
  2. 2. What is a CVS for?• Allow team work together and collaborate• Have some kind of time machine in our code• Allow CI
  3. 3. Approaches (architectural models)• Local• Rcs (Mac OS Developer Tools)• Centralized• Subversion• CVS• Perforce• Distributed• Git• Mercurial
  4. 4. Approaches (architectural models)• Local• Rcs (Mac OS Developer Tools)• Centralized• Subversion• CVS• Perforce• Distributed• Git• Mercurial
  5. 5. Very good resource
  6. 6. Centralized CVS
  7. 7. Distributed CVS
  8. 8. Centralized• Pros• Looks simple• We know it well; weve been using it for a long time• Good mainstream IDEs integration• It works • Cons• We cannot commit offline (well, we can, but …)• We cannot integrate in our development toolset more than onerepository• Dificult to collaborate if team is large (i.e. open source projects)• We are encouraged to avoid branches by the system.
  9. 9. Distributed• Pros• Allow offline work• Easy collaboration model• Can link as many repositories as we might need• Almost every operation is local• Complete copy of the repository in each machine• Easy installation on server, and plenty of hosting services (free andpaid)• Cons• More complex workflow (or not?)• Difficult to learn• ?????
  10. 10. Internal representation of data; SVN
  11. 11. Branching in SVN
  12. 12. Branching in SVNQuotes taken from official svn website• "For projects that have a large number of contributors, its common formost people to have working copies of the trunk. Whenever someoneneeds to make a long-running change that is likely to disrupt thetrunk, a standard procedure is to create a private branch and commitchanges there until all the work is complete"• "The bad news is that its very easy to drift too far apart (...) it may benear-impossible to merge your changes back into the trunk without ahuge number of conflicts"• "Subversion gives you the ability to selectively “copy” changesbetween branches. And when youre completely finished with yourbranch, your entire set of branch changes can be copied back into thetrunk. In Subversion terminology, the general act of replicatingchanges from one branch to another is called merging, and it isperformed using various invocations of the svn merge subcommand”
  13. 13. Branching in SVN I (typical workflow)• Checkout from trunk.• Add a new file to working copy• Check status (svn st).• Track new file in svn (svn add).• Commit the new file (svn ci).• Modify the file, and check status again (svn st).• Commit the new change.• Modify again and let it remain modified.
  14. 14. Branching in SVN II (branch & merge)• Svn copy at server level.• Check current working copy remote path (svn info).• Switch to new location (svn switch [remote] .)• Check remote again (svn info).• Commit some change to the branch.• Switch again to trunk.• Merge trunk with [myNewBranch] (svn merge [source@rev] .).Note that we do it with the working copy first to merge conflictslocally.• Commit to finish merge (we’ve done it locally in the previousstep).• Again with a non-conflicting change in the same file.• Again with a conflicting change.
  15. 15. Internal representation of data; svn• Repository: the main idea• Working copy• Revisions, which are deltas of a base state• The server has to workout deltas to resolve the concretestate of a revision (commit)• Each revision gets a unique (secuential) id. This ispossible because its centralized• Branches: are light copies of complete working trees• Summary: branch=copy.
  16. 16. Drawbacks I: only one remote
  17. 17. Drawbacks II: branch & merge sucks• Recall branch & merge procedure:• Copy trunk in branch directory in remote server• Checkout (or switch) locally.• Inspect revision we want to merge with, if not last.• Call svn merge.• Resolve conflicts (if any).• Commit the whole thing.• In practice we feel encouraged to not create branches(bad, bad, bad …).
  18. 18. Drawback III: cleanliness• What if I want to merge my branch just to get up to datewith our trunk, but I don’t want to make it public yet(incomplete feature or just playing around)?
  19. 19. Drawback IV: privacy• Do I have to publish my code to a remote/public server tohave version control? What if I’m doing some experimentsI don’t want other people to see, or I just don’t want tomess up our central repository with something I don’tknow if it’s going to work?
  20. 20. Internal representation of data; git
  21. 21. Git – file status lifecycle
  22. 22. Git internal storage structure: directedacyclic graph (DAG)•
  23. 23. Branching in git
  24. 24. Deeper insight in git DAG internalstructure
  25. 25. Another view of git objects I
  26. 26. Another view of git objects II
  27. 27. Another view of git objects III
  28. 28. Details on how git stores that in disk•
  29. 29. Branches and HEAD
  30. 30. More on git internal representation of data••• Due to its distributed nature unique ids for commits aregenerated as SHA-1 digest to ensure unicity• Explanation• Snapshots, not deltas• Commits: blobs• Branches: references to commits• Repeat: branch = pointer• Current branch: HEAD pointer• Detached heads: careful
  31. 31. SVN branch & merge summary• SVN has no branch concept. Its just another workingcopy with a common history• We can only merge two branches at a time• SVN allow you to merge even not at all related trees(error prone)• Refactor and moving things around; svn doesnt managethis kind of merges very well• Only allows interaction one repository at a time.
  32. 32. Git branch & merge summary• It’s trivial to create a new branch from any point.• Git prevents us from deleting unmerged branches.• We can clean up obsolete branches keeping commits.• We can move a branch around (recreate it from anystarting point).• We can merge more than one branch at a time (3 or evenmore!!!).• Git understands moved and renamed files.• This model encourage best practices: branch-per-feature,local branches for testing and experiments, git-flow …
  33. 33. Git allow us to manage branching well
  34. 34. Git integration with SVN
  35. 35. Interesting git resource•••••••
  36. 36. Wich CVS should I choose and when?