SlideShare a Scribd company logo
Understanding Distributed Source
            Control
About Me

 • Lorna Jane Mitchell

 • http://lornajane.net

 • PHP Consultant/Developer

 • Open Source project lead http://joind.in

 • Occasional writer/speaker

 • Twitter: @lornajane




                                              2
Source Control
The Aims of Source Control

 • Central keeping-place




                             4
The Aims of Source Control

 • Central keeping-place

 • History of changes




                             4
The Aims of Source Control

 • Central keeping-place

 • History of changes

 • Painless collaboration




                             4
Traditional Centralised Source Control

  • One repository (repo)

  • Working copies

  • Mature

  • Simple

  • Tools:

      • CVS
      • Subversion http://subversion.apache.org/




                                                   5
Traditional Centralised Source Control




                       repo



    checkout         checkout            checkout




                                                    6
Subversion

Recommended centralised solution

Project is now an Apache Software Foundation project. From the mission
statement:


     Subversion exists to be universally recognized and adopted as an
   open-source, centralized version control system characterized by its
reliability 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
Centralised Branching Strategies

There are a few common patterns when branching:

  • Version branches

  • Feature branches

  • Live branch




                                                  8
Code Merging with Centralised Systems

 • Make changes

 • Update

 • Commit

 • Merge happens on central repo

 • Can be slow




                                        9
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
Distributed Source Control




                         repo


       repo       repo          repo   repo




                                              11
Distributed Source Control

                     repo


                            repo


              repo


                                   repo


                     repo                 12
The Biggest Change




                     FAST




                            13
Snapshots vs Changesets

A 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 versions


http://www.joelonsoftware.com/items/2010/03/17.html




                                                                               14
Branching on Distributed Systems

 • Can branch any repo

 • Branches can be private




                                   15
Branching on Distributed Systems

 • Can branch any repo

 • Branches can be private

 • Merge commits from other branches on local repo




                                                     15
Working with Branches: Creating


$ git branch api

$ git branch
      api
    * master

$ git checkout api
    Switched to branch 'api'

$ git branch
    * api
      master




                                  16
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
Working with Branches: Switching


$ git checkout master
    Switched to branch 'master'

$ ls
    website




                                   18
Multiple Repositories




              main repo



             remote repo   local




                                   19
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
Timelines: git log –oneline


be81f69   Merge branch 'master' of git://github.com/joindin/joind.in
a67dabb   Merge commit 'fentie/issue91'
526039d   Merge commit 'jaytaph/JOINDIN-38-2'
0bc1a57   merge of hatfieldje/feature/JOINDIN-100
d3c7195   Added slide icon to talk-list
983d1a0   Fixed dates in CfP display and talk add/edit
4edf8be   Merge commit 'justincarmony/JOINDIN-97'
bec3ac1   Moving the settings from the method to the Controller's member
01d3feb   Admins can approve other admins
31ba4c1   Added counter to Event Claims link
ce2e46b   Updated README. Includes instructions for enabling RewriteEngi
ce356d5   Corrected session type dropbox
9c2f645   Merge commit 'justincarmony/74-howto-block'
0ce1551   Merge remote-tracking branch 'jaytaph/JOINDIN-104'




                                                                     21
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
Products and Supporting Tools
GUI Tools

Most 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
Bridging the Gap

Bridges: local DVCS functionality with centralised repos

Tools:

   • git-svn

   • bzr-svn

   • hg-git

   • and more




                                                           25
Supporting Distributed Workflows

Need to keep track of:

  • Commits on other repos

  • Relationships between repos

  • Patches (pull requests)




                                  26
Supporting Distributed Workflows

Need to keep track of:

  • Commits on other repos

  • Relationships between repos

  • Patches (pull requests)

Often: source browsing, documentation and issue trackers are also
included




                                                                    26
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
Understanding Distributed Source Control

  • Differences from centralised systems

  • Tools

  • Gotchas




                                           28
Questions?
Thanks!




 • Slides: http://slideshare.net/lornajane

 • Twitter: @lornajane

 • Web: http://lornajane.net/




                                             30

More Related Content

What's hot (20)

PDF
Simple Data Automation with Globus (GlobusWorld Tour West)
Globus
 
PDF
What's New in Rails 5
Marko Sanković
 
PDF
Webservices ingo
Uttam Gandhi
 
PPTX
Building Ext JS Using HATEOAS - Jeff Stano
Sencha
 
PDF
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
J V
 
PPTX
INF107 - Integrating HCL Domino and Microsoft 365
Dylan Redfield
 
PPTX
Survey of restful web services frameworks
Vijay Prasad Gupta
 
PDF
How pulsar stores data at Pulsar-na-summit-2021.pptx (1)
Shivji Kumar Jha
 
PPTX
Integrate ManifoldCF with Solr
francelabs
 
PDF
The never-ending REST API design debate -- Devoxx France 2016
Restlet
 
PDF
Server-side Java Programming
Chris Schalk
 
PDF
I A+ Open+ Source+ Secret+ Sauce
guest1babda
 
ODP
Soa With Ruby
zak.mandhro
 
PDF
lessons from managing a pulsar cluster
Shivji Kumar Jha
 
PPTX
Stack Exchange Infrastructure - LISA 14
GABeech
 
PPT
Common gateway interface
Anandita
 
PPTX
Soccnx11 Two wrongs don't make a right - Troubleshooting Connections
Nico Meisenzahl
 
PPTX
Melbourne User Group OAK and MongoDB
Yuval Ararat
 
PPTX
SOCCNX11 All you need to know about Orient Me
Nico Meisenzahl
 
Simple Data Automation with Globus (GlobusWorld Tour West)
Globus
 
What's New in Rails 5
Marko Sanković
 
Webservices ingo
Uttam Gandhi
 
Building Ext JS Using HATEOAS - Jeff Stano
Sencha
 
Deep Dive: Alfresco Core Repository (... embedded in a micro-services style a...
J V
 
INF107 - Integrating HCL Domino and Microsoft 365
Dylan Redfield
 
Survey of restful web services frameworks
Vijay Prasad Gupta
 
How pulsar stores data at Pulsar-na-summit-2021.pptx (1)
Shivji Kumar Jha
 
Integrate ManifoldCF with Solr
francelabs
 
The never-ending REST API design debate -- Devoxx France 2016
Restlet
 
Server-side Java Programming
Chris Schalk
 
I A+ Open+ Source+ Secret+ Sauce
guest1babda
 
Soa With Ruby
zak.mandhro
 
lessons from managing a pulsar cluster
Shivji Kumar Jha
 
Stack Exchange Infrastructure - LISA 14
GABeech
 
Common gateway interface
Anandita
 
Soccnx11 Two wrongs don't make a right - Troubleshooting Connections
Nico Meisenzahl
 
Melbourne User Group OAK and MongoDB
Yuval Ararat
 
SOCCNX11 All you need to know about Orient Me
Nico Meisenzahl
 

Similar to Understanding Distributed Source Control (20)

PPTX
GIT INTRODUCTION
MohanRaviRohitth
 
PDF
The Source Control Landscape
Lorna Mitchell
 
PDF
Git Educated About Git - 20 Essential Commands
Jeremy Lindblom
 
PDF
SQL Server DevOps Jumpstart
Ori Donner
 
PDF
Git, GitHub and Open Source
Lorna Mitchell
 
PDF
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Ahmed El-Arabawy
 
PDF
Session: Git Basics & GitFlow Workflow
Midhun Mohanan
 
PPTX
Git Workflows
Noam Kfir
 
PPTX
git Technologies
Hirantha Pradeep
 
PPTX
Git Basics for Software Version Management
ishanmittal49
 
PPTX
Git presentation to some coworkers some time ago
Rodrigo Urubatan
 
PPTX
the Version Control systemlocalized.pptx
rkalpanase
 
PPTX
Mini-training: Let’s Git It!
Betclic Everest Group Tech Team
 
PPTX
GIT In Detail
Haitham Raik
 
PPTX
Version Control Systems -- Git -- Part I
Sergey Aganezov
 
PDF
Switching to Git
Stephen Yeargin
 
PPTX
Source control - what you need to know
daveymni
 
PDF
Git SVN Migrate Reasons
Ovidiu Dimulescu
 
PDF
Git & GitHub N00bs
YasserElsnbary
 
PPTX
Cloud Foundry Roadmap Update - OSCON - May 2017
Chip Childers
 
GIT INTRODUCTION
MohanRaviRohitth
 
The Source Control Landscape
Lorna Mitchell
 
Git Educated About Git - 20 Essential Commands
Jeremy Lindblom
 
SQL Server DevOps Jumpstart
Ori Donner
 
Git, GitHub and Open Source
Lorna Mitchell
 
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Ahmed El-Arabawy
 
Session: Git Basics & GitFlow Workflow
Midhun Mohanan
 
Git Workflows
Noam Kfir
 
git Technologies
Hirantha Pradeep
 
Git Basics for Software Version Management
ishanmittal49
 
Git presentation to some coworkers some time ago
Rodrigo Urubatan
 
the Version Control systemlocalized.pptx
rkalpanase
 
Mini-training: Let’s Git It!
Betclic Everest Group Tech Team
 
GIT In Detail
Haitham Raik
 
Version Control Systems -- Git -- Part I
Sergey Aganezov
 
Switching to Git
Stephen Yeargin
 
Source control - what you need to know
daveymni
 
Git SVN Migrate Reasons
Ovidiu Dimulescu
 
Git & GitHub N00bs
YasserElsnbary
 
Cloud Foundry Roadmap Update - OSCON - May 2017
Chip Childers
 
Ad

More from Lorna Mitchell (20)

PDF
Web Services PHP Tutorial
Lorna Mitchell
 
PDF
Business 101 for Developers: Time and Money
Lorna Mitchell
 
ODP
Things I wish web graduates knew
Lorna Mitchell
 
PDF
Teach a Man To Fish (phpconpl edition)
Lorna Mitchell
 
PDF
Web services tutorial
Lorna Mitchell
 
ODP
Join In With Joind.In
Lorna Mitchell
 
PDF
Tool Up Your LAMP Stack
Lorna Mitchell
 
PDF
Going Freelance
Lorna Mitchell
 
PDF
Best Practice in Web Service Design
Lorna Mitchell
 
PDF
Coaching Development Teams: Teach A Man To Fish
Lorna Mitchell
 
PDF
Zend Certification Preparation Tutorial
Lorna Mitchell
 
PDF
Implementing OAuth with PHP
Lorna Mitchell
 
PDF
Web Services Tutorial
Lorna Mitchell
 
PDF
Object Oriented Programming in PHP
Lorna Mitchell
 
PDF
Example Presentation
Lorna Mitchell
 
PDF
Could You Telecommute?
Lorna Mitchell
 
PDF
Design Patterns
Lorna Mitchell
 
PDF
Running a Project with Github
Lorna Mitchell
 
PDF
27 Ways To Be A Better Developer
Lorna Mitchell
 
PDF
Digital Representation
Lorna Mitchell
 
Web Services PHP Tutorial
Lorna Mitchell
 
Business 101 for Developers: Time and Money
Lorna Mitchell
 
Things I wish web graduates knew
Lorna Mitchell
 
Teach a Man To Fish (phpconpl edition)
Lorna Mitchell
 
Web services tutorial
Lorna Mitchell
 
Join In With Joind.In
Lorna Mitchell
 
Tool Up Your LAMP Stack
Lorna Mitchell
 
Going Freelance
Lorna Mitchell
 
Best Practice in Web Service Design
Lorna Mitchell
 
Coaching Development Teams: Teach A Man To Fish
Lorna Mitchell
 
Zend Certification Preparation Tutorial
Lorna Mitchell
 
Implementing OAuth with PHP
Lorna Mitchell
 
Web Services Tutorial
Lorna Mitchell
 
Object Oriented Programming in PHP
Lorna Mitchell
 
Example Presentation
Lorna Mitchell
 
Could You Telecommute?
Lorna Mitchell
 
Design Patterns
Lorna Mitchell
 
Running a Project with Github
Lorna Mitchell
 
27 Ways To Be A Better Developer
Lorna Mitchell
 
Digital Representation
Lorna Mitchell
 
Ad

Understanding Distributed Source Control

  • 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
  • 4. The Aims of Source Control • Central keeping-place 4
  • 5. The Aims of Source Control • Central keeping-place • History of changes 4
  • 6. The Aims of Source Control • Central keeping-place • History of changes • Painless collaboration 4
  • 7. Traditional Centralised Source Control • One repository (repo) • Working copies • Mature • Simple • Tools: • CVS • Subversion http://subversion.apache.org/ 5
  • 8. Traditional Centralised Source Control repo checkout checkout checkout 6
  • 9. Subversion Recommended centralised solution Project is now an Apache Software Foundation project. From the mission statement: Subversion exists to be universally recognized and adopted as an open-source, centralized version control system characterized by its reliability 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. Centralised Branching Strategies There are a few common patterns when branching: • Version branches • Feature branches • Live branch 8
  • 11. Code Merging with Centralised Systems • Make changes • Update • Commit • Merge happens on central repo • Can be slow 9
  • 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. Distributed Source Control repo repo repo repo repo 11
  • 14. Distributed Source Control repo repo repo repo repo 12
  • 16. Snapshots vs Changesets A 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 versions http://www.joelonsoftware.com/items/2010/03/17.html 14
  • 17. Branching on Distributed Systems • Can branch any repo • Branches can be private 15
  • 18. Branching on Distributed Systems • Can branch any repo • Branches can be private • Merge commits from other branches on local repo 15
  • 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. 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. Working with Branches: Switching $ git checkout master Switched to branch 'master' $ ls website 18
  • 22. Multiple Repositories main repo remote repo local 19
  • 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. Timelines: git log –oneline be81f69 Merge branch 'master' of git://github.com/joindin/joind.in a67dabb Merge commit 'fentie/issue91' 526039d Merge commit 'jaytaph/JOINDIN-38-2' 0bc1a57 merge of hatfieldje/feature/JOINDIN-100 d3c7195 Added slide icon to talk-list 983d1a0 Fixed dates in CfP display and talk add/edit 4edf8be Merge commit 'justincarmony/JOINDIN-97' bec3ac1 Moving the settings from the method to the Controller's member 01d3feb Admins can approve other admins 31ba4c1 Added counter to Event Claims link ce2e46b Updated README. Includes instructions for enabling RewriteEngi ce356d5 Corrected session type dropbox 9c2f645 Merge commit 'justincarmony/74-howto-block' 0ce1551 Merge remote-tracking branch 'jaytaph/JOINDIN-104' 21
  • 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
  • 27. GUI Tools Most 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. Bridging the Gap Bridges: local DVCS functionality with centralised repos Tools: • git-svn • bzr-svn • hg-git • and more 25
  • 29. Supporting Distributed Workflows Need to keep track of: • Commits on other repos • Relationships between repos • Patches (pull requests) 26
  • 30. Supporting Distributed Workflows Need to keep track of: • Commits on other repos • Relationships between repos • Patches (pull requests) Often: source browsing, documentation and issue trackers are also included 26
  • 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. Understanding Distributed Source Control • Differences from centralised systems • Tools • Gotchas 28
  • 34. Thanks! • Slides: http://slideshare.net/lornajane • Twitter: @lornajane • Web: http://lornajane.net/ 30