Understanding Distributed Source Control

4,406 views

Published on

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,406
On SlideShare
0
From Embeds
0
Number of Embeds
1,454
Actions
Shares
0
Downloads
35
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Understanding Distributed Source Control

  1. 1. Understanding Distributed Source Control
  2. 2. About Me • Lorna Jane Mitchell • http://lornajane.net • PHP Consultant/Developer • Open Source project lead http://joind.in • Occasional writer/speaker • Twitter: @lornajane 2
  3. 3. Source Control
  4. 4. The Aims of Source Control • Central keeping-place 4
  5. 5. The Aims of Source Control • Central keeping-place • History of changes 4
  6. 6. The Aims of Source Control • Central keeping-place • History of changes • Painless collaboration 4
  7. 7. Traditional Centralised Source Control • One repository (repo) • Working copies • Mature • Simple • Tools: • CVS • Subversion http://subversion.apache.org/ 5
  8. 8. Traditional Centralised Source Control repo checkout checkout checkout 6
  9. 9. SubversionRecommended centralised solutionProject is now an Apache Software Foundation project. From the missionstatement: Subversion exists to be universally recognized and adopted as an open-source, centralized version control system characterized by itsreliability as a safe haven for valuable data; the simplicity of its model and usage; and its ability to support the needs of a wide variety of users and projects, from individuals to large-scale enterprise operations.http://lwn.net/Articles/381794/ 7
  10. 10. Centralised Branching StrategiesThere are a few common patterns when branching: • Version branches • Feature branches • Live branch 8
  11. 11. Code Merging with Centralised Systems • Make changes • Update • Commit • Merge happens on central repo • Can be slow 9
  12. 12. Distributed Source Control • Many repos • Local repo • Tools (all with comparable features) • Git http://git-scm.com/ • Mercurial http://mercurial.selenic.com/ • Bazaar http://bazaar.canonical.com/ • Powerful/complex 10
  13. 13. Distributed Source Control repo repo repo repo repo 11
  14. 14. Distributed Source Control repo repo repo repo repo 12
  15. 15. The Biggest Change FAST 13
  16. 16. Snapshots vs ChangesetsA revision number describes a set of patches. Not a state of code. With distributed version control, the distributed part is actually not the most interesting part. The interesting part is that these systems think in terms of changes, not in terms of versionshttp://www.joelonsoftware.com/items/2010/03/17.html 14
  17. 17. Branching on Distributed Systems • Can branch any repo • Branches can be private 15
  18. 18. Branching on Distributed Systems • Can branch any repo • Branches can be private • Merge commits from other branches on local repo 15
  19. 19. Working with Branches: Creating$ git branch api$ git branch api * master$ git checkout api Switched to branch api$ git branch * api master 16
  20. 20. Working with Branches: Using$ mkdir api$ vim api/index.php$ git add api/$ git commit -m "added the web service" [api 62582e1] added the web service 1 files changed, 4 insertions(+), 0 deletions(-) create mode 100644 api/index.php$ ls api website 17
  21. 21. Working with Branches: Switching$ git checkout master Switched to branch master$ ls website 18
  22. 22. Multiple Repositories main repo remote repo local 19
  23. 23. Timelines • Commits keep their timestamps • They show at the time they were commited • To a repo • Not when they were merged to this one • Tools help illustrate 20
  24. 24. Timelines: git log –onelinebe81f69 Merge branch master of git://github.com/joindin/joind.ina67dabb Merge commit fentie/issue91526039d Merge commit jaytaph/JOINDIN-38-20bc1a57 merge of hatfieldje/feature/JOINDIN-100d3c7195 Added slide icon to talk-list983d1a0 Fixed dates in CfP display and talk add/edit4edf8be Merge commit justincarmony/JOINDIN-97bec3ac1 Moving the settings from the method to the Controllers member01d3feb Admins can approve other admins31ba4c1 Added counter to Event Claims linkce2e46b Updated README. Includes instructions for enabling RewriteEngice356d5 Corrected session type dropbox9c2f645 Merge commit justincarmony/74-howto-block0ce1551 Merge remote-tracking branch jaytaph/JOINDIN-104 21
  25. 25. Timelines: git log –graph –oneline* be81f69 Merge branch master of git://github.com/joindin/joind.in|| * a67dabb Merge commit fentie/issue91| || | * 2b229ef IDE removing extra EOL whitespace| | * 82b3aa7 switching to single empty test instead of !isset and fal| | * b03d6df adding check to ensure speakers cannot rate their own ta| * | 526039d Merge commit jaytaph/JOINDIN-38-2| | | | * | 01d3feb Admins can approve other admins| | * | 31ba4c1 Added counter to Event Claims link| * | | 0bc1a57 merge of hatfieldje/feature/JOINDIN-100| | | | * | | 983d1a0 Fixed dates in CfP display and talk add/edit| | * | | 0ddfd83 JOINDIN-100| | * | | d00e1f3 feature/JOINDIN-100| | * | | f5a5775 feature/JOINDIN-100| * | | | d3c7195 Added slide icon to talk-list 22
  26. 26. Products and Supporting Tools
  27. 27. GUI ToolsMost OS/DVCS combinations covered • IDE plugins • Versions on OS X for SVN • Tower on OS X for git • Tortoise* for Windows users • git and windows not recommended • CLI on every platform 24
  28. 28. Bridging the GapBridges: local DVCS functionality with centralised reposTools: • git-svn • bzr-svn • hg-git • and more 25
  29. 29. Supporting Distributed WorkflowsNeed to keep track of: • Commits on other repos • Relationships between repos • Patches (pull requests) 26
  30. 30. Supporting Distributed WorkflowsNeed to keep track of: • Commits on other repos • Relationships between repos • Patches (pull requests)Often: source browsing, documentation and issue trackers are alsoincluded 26
  31. 31. Collaboration Sites • Git • Github http://github.com/ • Gitorious http://gitorious.org/ • Mercurial • Bitbucket http://bitbucket.org/ • Bazaar • Launchpad http://launchpad.net/Also Sourceforge who support all of the above and more http://sf.net 27
  32. 32. Understanding Distributed Source Control • Differences from centralised systems • Tools • Gotchas 28
  33. 33. Questions?
  34. 34. Thanks! • Slides: http://slideshare.net/lornajane • Twitter: @lornajane • Web: http://lornajane.net/ 30

×