Embracing Distributed Version Control


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

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

No notes for slide

Embracing Distributed Version Control

  1. 1. Embracing Distributed Version Control How to Drastically Improve Collaboration, Experimentation, Productivity, Freedom, Flexibility, Data Integrity and take two strokes off of your golf game
  2. 2. Lets Talk About It <ul><li>Open Forum </li></ul><ul><ul><li>Ask questions </li></ul></ul><ul><ul><li>Ask for demonstrations  </li></ul></ul><ul><ul><li>Add opinions </li></ul></ul><ul><ul><li>Share experiences </li></ul></ul><ul><ul><li>Try it yourself </li></ul></ul>
  3. 3. What's the Big Deal? <ul><ul><li>Tools should mold to your process </li></ul></ul><ul><ul><li>Projects have lots of independent features </li></ul></ul><ul><ul><li>Feature isolation </li></ul></ul><ul><ul><li>&quot;Major Milestone&quot; vs. &quot;Release Often&quot; </li></ul></ul><ul><ul><li>&quot;Only commit when its done&quot; is limiting </li></ul></ul>
  4. 4. The Basics  
  5. 5. Centralized Version Control Systems <ul><ul><li>One centralized server with the revision database </li></ul></ul><ul><ul><ul><li>single point of failure </li></ul></ul></ul><ul><ul><li>Clients checkout a working copy to their machine </li></ul></ul><ul><ul><li>Most operations happen on the server </li></ul></ul><ul><ul><li>Checkouts/Updates happen one directory at a time </li></ul></ul><ul><ul><li>Linear revision history (merges squash commits) </li></ul></ul><ul><ul><li>Every directory contains a &quot;special folder&quot; </li></ul></ul><ul><li>  </li></ul>
  6. 6. Distributed Version Control Systems <ul><ul><li>Every client has a full revision history locally </li></ul></ul><ul><ul><ul><li># backups == # clients  </li></ul></ul></ul><ul><ul><ul><li>no need to be online </li></ul></ul></ul><ul><ul><li>All operations are local (except sharing) </li></ul></ul><ul><ul><li>Non-linear revision history </li></ul></ul><ul><ul><li>Network operations are compressed into packed downloads </li></ul></ul><ul><ul><li>Working copy is independent of versioning system </li></ul></ul>
  7. 7. Different to the Core
  8. 8. How Did We Get Here Again? <ul><li>  </li></ul>
  9. 9. There Can Only Be One... or maybe two <ul><ul><li>Everyone has their own opinions </li></ul></ul><ul><ul><li>In the end choose what system fits best </li></ul></ul><ul><ul><ul><li>but whatever you do, choose a DVCS (at least for your local development) </li></ul></ul></ul><ul><ul><li>Today we will compare SVN and GIT </li></ul></ul>
  10. 10. Lets Take a Walk... Side by Side SVN GIT Obtain Code svn checkout <url> git clone <url> Add Files svn add file1.php *.css git add file1.php *.css Status svn status git status Differences svn diff | less git diff Restore File svn revert <path> git checkout <path> Commit All Changes svn commit git commit -a Get Latest Updates svn update git pull Share Latest Edits git push
  11. 11. Branching  
  12. 12. I've Branched Before... So What? <ul><ul><li>With CVCS branching is used to separate major releases </li></ul></ul><ul><ul><li>Branching is always followed by merging </li></ul></ul><ul><ul><li>Both tasks need to be easy and inexpensive </li></ul></ul>
  13. 13. Branching is Hard... Or is it? <ul><li>Tasks </li></ul><ul><ul><li>Obtain the source code </li></ul></ul><ul><ul><li>Create Branch </li></ul></ul><ul><ul><li>Switch Branch </li></ul></ul><ul><ul><li>Merge Branch </li></ul></ul>
  14. 14. Branching is Hard... Or is it? <ul><li>  </li></ul><ul><li>  </li></ul><ul><li>      REPO=http://svn.php.net/repository/php/php-src/ </li></ul><ul><ul><li>svn checkout $REPO/trunk  (10 minutes) </li></ul></ul><ul><ul><li>svn copy $REPO/branches/PHP_5_3 $REPO/branches/PHP_5_5  (4 minutes) </li></ul></ul><ul><ul><li>svn switch $REPO/branches/PHP_5_5   (50 seconds) </li></ul></ul><ul><ul><li>svn merge -r 20:HEAD $REPO/branches/PHP_5_3 (claw your eyes out) </li></ul></ul><ul><li>  </li></ul><ul><li>Total Time: ~15 minutes + clawing your eyes out  </li></ul><ul><li>Total Time Branching: ~5 minutes </li></ul><ul><li>  </li></ul>
  15. 15. Branching is Hard... Or is it? <ul><li>  </li></ul><ul><ul><li>git clone git://github.com/php/php-src.git  (3 minutes)   </li></ul></ul><ul><ul><li>git branch PHP_5_5 origin/PHP_5_3  (5 milliseconds) </li></ul></ul><ul><ul><li>git checkout PHP_5_5   (2 seconds) </li></ul></ul><ul><ul><li>git merge origin/PHP_5_3   (1 second) </li></ul></ul><ul><li>  </li></ul><ul><li>Total Time: ~3 minutes </li></ul><ul><li>Total Time Branching: ~3 seconds </li></ul>
  16. 16. OK. So Branching Is Easy... Now What? <ul><ul><li>Cheap and easy branching fundamentally changes the way you approach development </li></ul></ul><ul><ul><li>Everything is done on a branch </li></ul></ul><ul><ul><li>Issue isolation is now a reality </li></ul></ul>
  17. 17. Every Change Has Its Place in a Branch <ul><li>You can use any branching style you choose. Here's an example: </li></ul><ul><ul><li>master </li></ul></ul><ul><ul><ul><li>also referred to as trunk </li></ul></ul></ul><ul><ul><li>hotfix-X </li></ul></ul><ul><ul><ul><li>quick fixes to master </li></ul></ul></ul><ul><ul><li>develop </li></ul></ul><ul><ul><ul><li>integration point for all completed feature branches </li></ul></ul></ul><ul><ul><li>feature-Y </li></ul></ul><ul><ul><ul><li>every discreet issue is worked on in a feature branch </li></ul></ul></ul>complete walk-through: http://nvie.com/git-model
  18. 19. Workflow  
  19. 20. Your Centralized Workflow <ul><li>With Centralized Version Control Systems, your workflow will always look like this. </li></ul>image source: http://whygitisbetterthanx.com
  20. 21. Chose Your Own Adventure Workflow <ul><li>With Distributed Version Control Systems you can morph your workflow to meet your needs. You can do it the same... </li></ul>image source: http://whygitisbetterthanx.com
  21. 22. Or It Can Work Like This... <ul><li>Integration Manager Approach </li></ul><ul><ul><li>Useful for small to large teams </li></ul></ul><ul><ul><li>Integration manager merges all feature branches into mainline </li></ul></ul>
  22. 23. Or It Can Work Like This... <ul><li>Dictator and Lieutenants </li></ul><ul><ul><li>Useful for large teams </li></ul></ul><ul><ul><li>Team Leaders curate new feature branches into production ready state </li></ul></ul><ul><ul><li>Dictator has final say and merged into mainline </li></ul></ul>
  23. 24. Migration & Integration  
  24. 25. Dipping Your Toes in the Water <ul><ul><li>Use your favorite DVCS with most other VCS repositories </li></ul></ul><ul><ul><li>Push and Pull changes between systems  </li></ul></ul>
  25. 26. Diving in Head First <ul><ul><li>Import entire history/branches from legacy systems </li></ul></ul><ul><ul><li>Rinse & repeat: make you have everything before you switch </li></ul></ul>
  26. 27. References <ul><li>GIT </li></ul><ul><ul><li>http://git-scm.com/course/svn.html </li></ul></ul><ul><ul><li>http://whygitisbetterthanx.com/ </li></ul></ul><ul><ul><li>http://nvie.com/git-model/  </li></ul></ul><ul><ul><li>http://progit.org/book/  </li></ul></ul><ul><ul><li>http://gitref.org/  </li></ul></ul><ul><ul><li>http://gitready.com/ </li></ul></ul><ul><li>  </li></ul><ul><li>Mercurial </li></ul><ul><ul><li>http://hginit.com/ </li></ul></ul>
  27. 28. Get In Touch <ul><li>Nowell Strite </li></ul><ul><ul><li>Twitter: nowells </li></ul></ul><ul><ul><li>Email: nowell@strite.org </li></ul></ul><ul><li>  </li></ul><ul><li>Matthew Weier O'Phinney </li></ul><ul><ul><li>Twitter: weierophinney </li></ul></ul><ul><ul><li>Email: matthew@weierophinney.net </li></ul></ul>