Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Migrating from Subversion to Git and GitHub

Migrating from Subversion to Git and GitHub

Git is a compelling version control system, but it is useful to talk about it in the context of a destination, made possible by migration tools from previous version control systems like Subversion. This talk offers a set of motivations, tools, and techniques on the Subversion to Git and GitHub migration process.

Bededa744012c87721d68f69342f81b0?s=128

Matthew McCullough

April 21, 2012
Tweet

Transcript

  1. VERSION CONTROL REINVIGORATED from Subversion to Git and GitHub

  2. VERSION CONTROL REINVIGORATED from Subversion to Git and GitHub from

    Subversion to Git and GitHub
  3. @matthewmccull matthew@github.com github.com/training

  4. Who is Matthew? Open source contributor Build tool and continuous

    delivery author 5 year Git evangelist VP of Training at GitHub
  5. The Change

  6. SVN ‛ GIT

  7. None
  8. None
  9. None
  10. — Every manager, ever If it isn't broke, don't fix

    it.
  11. The Radar

  12. None
  13. None
  14. July 2011 Technology Radar Prepared by the ThoughtWorks Technology Advisory

    Board http://www.thoughtworks.com/radar
  15. July 2011 Technology Radar Prepared by the ThoughtWorks Technology Advisory

    Board http://www.thoughtworks.com/radar Tools 30. Subversion 31. Git 32. Infrastructure as code 33. Github 34. Caching reverse proxies 35. Splunk 36. Mercurial 37. Message buses without smarts 38. NoSQL 39. Next gen test tools 40. New Relic beyond Rails 41. TLB 42. Powershell 43. Selenium 2 testing of mobile websites 44. Deltacloud 45. Vagrant 46. API management services 47. jQuery Mobile 48. Backbone.js 49. Sonar 50. Open source bI tools 51. Gradle 52. Cross platform mobile toolkits 53. ESB 54. VCS with “implicit workflow” 55. Code in configuration 26 16 13 22 12 5 3 32 36 46 53 45 44 37 39 35 38 30 4 6 56 76 69 58 57 7 15 14 25 29 28 27 21 23 17 19 24 18 20 11 9 2 10 31 33 42 41 40 50 47 48 49 51 54 43 55 52 34 1 8 New or Moved No change Techniques 1. Progressive enhancement 2. Automate database deployment 3. Platform roadmaps 4. Evolutionary database 5. Emergent design 6. Visualization and metrics 7. Coding architects 8. Evolutionary architecture 9. DevOps 10. Simple performance trending 11. Continuous delivery 12. Concurrency abstractions and patterns 13. Acceptance test of journeys 14. Categorization & prioritization of technical debt 15. Continuous deployment 16. Capability modeling 17. Thoughtful caching 18. Iterative data warehousing 19. Build your own radar 20. Event API’s 21. Event driven business intelligence 22. Smart systems 23. Event sourcing 24. Decision driven BI 25. Scrum certification 26. Database based integration 27. Procedure oriented integration 28. Feature branching 29. Manual infrastructure management
  16. Tools 30. Subversion 31. Git 32. Infrastructure as code 33.

    Github 34. Caching reverse proxies 35. Splunk 36. Mercurial 37. Message buses without smarts 38. NoSQL 39. Next gen test tools 40. New Relic beyond Rails 41. TLB 42. Powershell 43. Selenium 2 testing of mobile websites 44. Deltacloud 45. Vagrant 46. API management services 47. jQuery Mobile 48. Backbone.js 49. Sonar 50. Open source bI tools 51. Gradle 52. Cross platform mobile toolkits 53. ESB 54. VCS with “implicit workflow” 55. Code in configuration 26 16 13 22 12 5 3 32 36 46 53 45 44 37 39 35 38 30 4 6 7 15 14 25 29 28 27 21 23 17 19 24 18 20 11 9 2 10 31 33 42 41 40 50 47 48 49 51 54 43 55 52 34 1 8 New or Moved No change Techniques 1. Progressive enhancement 2. Automate database deployment 3. Platform roadmaps 4. Evolutionary database 5. Emergent design 6. Visualization and metrics 7. Coding architects 8. Evolutionary architecture 9. DevOps 10. Simple performance trending 11. Continuous delivery 12. Concurrency abstractions and patterns 13. Acceptance test of journeys 14. Categorization & prioritization of technical debt 15. Continuous deployment 16. Capability modeling 17. Thoughtful caching 18. Iterative data warehousing 19. Build your own radar 20. Event API’s 21. Event driven business intelligence 22. Smart systems 23. Event sourcing 24. Decision driven BI 25. Scrum certification 26. Database based integration 27. Procedure oriented integration 28. Feature branching 29. Manual infrastructure management
  17. Tools 30. Subversion 31. Git 32. Infrastructure as code 33.

    Github 34. Caching reverse proxies 35. Splunk 36. Mercurial 37. Message buses without smarts 38. NoSQL 39. Next gen test tools 40. New Relic beyond Rails 41. TLB 42. Powershell 43. Selenium 2 testing of mobile websites 44. Deltacloud 45. Vagrant 46. API management services 47. jQuery Mobile 48. Backbone.js 49. Sonar 50. Open source bI tools 51. Gradle 52. Cross platform mobile toolkits 53. ESB 54. VCS with “implicit workflow” 55. Code in configuration 26 16 13 22 12 5 3 32 36 46 53 45 44 37 39 35 38 30 4 6 7 15 14 25 29 28 27 21 23 17 19 24 18 20 11 9 2 10 31 33 42 41 40 50 47 48 49 51 54 43 55 52 34 1 8 New or Moved No change Techniques 1. Progressive enhancement 2. Automate database deployment 3. Platform roadmaps 4. Evolutionary database 5. Emergent design 6. Visualization and metrics 7. Coding architects 8. Evolutionary architecture 9. DevOps 10. Simple performance trending 11. Continuous delivery 12. Concurrency abstractions and patterns 13. Acceptance test of journeys 14. Categorization & prioritization of technical debt 15. Continuous deployment 16. Capability modeling 17. Thoughtful caching 18. Iterative data warehousing 19. Build your own radar 20. Event API’s 21. Event driven business intelligence 22. Smart systems 23. Event sourcing 24. Decision driven BI 25. Scrum certification 26. Database based integration 27. Procedure oriented integration 28. Feature branching 29. Manual infrastructure management
  18. 26 16 13 22 12 5 3 32 36 46

    53 45 44 37 39 35 38 30 4 6 56 74 76 69 58 57 7 15 14 25 29 28 27 21 23 17 19 24 18 20 11 9 2 10 80 75 60 31 33 42 41 40 50 47 48 49 51 54 43 55 52 34 1 8 Ne No ation & prioritization cal debt us deployment y modeling ul caching data warehousing
  19. Migration Tools

  20. git-svn

  21. git-svn Core Git feature

  22. $ git svn clone -s http://yourhost.com/reporoot/

  23. git-svn Consumes an authors email mapping file

  24. (no author) = Codehaus infra <support@codehaus.org> sdevijver = Steven Devijver

    <support@codehaus.org> markcc = Mark CC <support@codehaus.org> joe = Joe <support@codehaus.org> ajtarter = Aaron J Tarter <support@codehaus.org> liddon = Lidia Donajczyk-Lipinska <support@codehaus.org> jshickey = Scott Hickey <jshickey@yahoo.com> HamletDRC = Hamlet D'Arcy <hamletdrc@gmail.com> aalmiray = Andres Almiray <aalmiray@gmail.com> blackdrag = Jochen Theodorou <blackdrag@gmx.org> bob = Boc McWhirter <bob@codehaus.org> brownj = Jeff Brown <jeff@jeffandbetsy.net> cstein = Christian Stein <sormuras@gmx.de>
  25. git-svn Migrates Subversion tags to Git branches

  26. svn2git

  27. None
  28. $ svn2git http://matthew.com/svnrepos/project1

  29. importing to git

  30. None
  31. # Publish one branch $ svn2git http://matthew.com/svnrepos/project1 $ git remote

    add origin https://github.com/you/project1 $ git push origin master
  32. # Publish all branches and tags $ svn2git http://matthew.com/svnrepos/svnproject1 $

    git clone file://yourpath/svnproject1 gitproject1 $ cd gitproject1 $ git remote add origin https://github.com/you/project1 $ git push --mirror origin
  33. Serving SVN from Git

  34. None
  35. $ svn co https://github.com/you/project1/trunk p1svn

  36. Data Structures

  37. — No engineer, ever Wow! Version control!

  38. DAG

  39. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B
  40. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B Δ Δ Δ Δ Δ Δ Δ
  41. None
  42. Checkin Checkin Checkin Checkin Checkin Checkin Checkin Checkin Checkin Checkin

    Checkin Delta storage gets slower as the history of a file gets longer
  43. None
  44. Copy of the entire tree per commit

  45. Why?

  46. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  47. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  48. hard link to existing identical blobs

  49. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  50. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C ß
  51. zlib deflates each blob at commit

  52. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  53. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  54. zlib deflates the entire repo

  55. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  56. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  57. Act I 2100 MB became 205 MB

  58. refs

  59. centralized VCSs use sequential revision numbers

  60. Git uses a SHA-1 hash

  61. None
  62. 40 hex characters (20 bytes)

  63. 9AB223D28B1AA46EF1780B22F304982E39872C34

  64. 9AB223D28B1AA46EF1780B22F304982E39872C34 <html> <body> <p>This is a test</p> <img src="http://ai.com/icon.gif"> </body>

    </html>
  65. <html> <body> <p>This is a test</p> <img src="http://ai.com/icon.gif"> </body> </html>

    9AB223D28B1AA46EF1780B22F304982E39872C34
  66. ‣Blob ‣Tree ‣Commit ‣Tag

  67. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  68. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  69. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  70. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  71. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  72. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  73. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  74. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  75. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  76. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  77. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  78. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  79. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  80. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  81. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  82. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  83. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  84. RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit

    8c2d1 commit 1bdcd commit 2daa1
  85. RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit

    8c2d1 commit 1bdcd commit 2daa1
  86. RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit

    8c2d1 commit 1bdcd commit 2daa1
  87. RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit

    8c2d1 commit 1bdcd commit 2daa1
  88. RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit

    8c2d1 commit 1bdcd commit 2daa1
  89. RELEASE_1.0 HEAD bug979branch commit c67db commit 9bd21 commit 1c2d7 commit

    8c2d1 commit 1bdcd commit 2daa1
  90. Git Highlights

  91. Local commits

  92. Content Tracking

  93. simpler Merges

  94. Start now

  95. git-svn conversion to Git git-svn bridge to SVN GitHub SVN

    URLs Conversion Options
  96. None
  97. Thanks!

  98. @matthewmccull matthew@github.com github.com/training