Difference between revisions of "Git/migrating to git"

From Freephile Wiki
< Git
Jump to navigation Jump to search
(Modified version of the outline at https://wiki.eclipse.org/Git/Migrating_to_Git)
 
(edits)
Line 3: Line 3:
 
<ol>
 
<ol>
 
<li> Discussions with stakeholders, project lead
 
<li> Discussions with stakeholders, project lead
<li> Leverage the resources and expertise of prior large migrations including [https://git-scm.com/book/en/v2/Git-and-Other-Systems-Migrating-to-Git Pro Git 2nd Ed.] [https://wiki.eclipse.org/Git/Migrating_to_Git Eclipse Foundation], [https://blogs.atlassian.com/2013/01/atlassian-svn-to-git-migration-human-side/ Atlassian], [https://blog.wikimedia.org/2012/02/15/wikimedia-engineering-moving-from-subversion-to-git/ Wikimedia Foundation], [https://www.eclipsecon.org/europe2013/tale-about-big-svn-git-migration EclipseCon proposed talk by Max Anderson], [https://groups.drupal.org/drupal-org-git-team Drupal], PostgreSQL, and Pentaho. Be sure to plan for the "before", the actual migration, and the "after" migration work.
+
<li> Leverage the resources and expertise of prior large migrations including [https://git-scm.com/book/en/v2/Git-and-Other-Systems-Migrating-to-Git Pro Git 2nd Ed.] [https://wiki.eclipse.org/Git/Migrating_to_Git Eclipse Foundation], [https://blogs.atlassian.com/2013/01/atlassian-svn-to-git-migration-human-side/ Atlassian], [https://blog.wikimedia.org/2012/02/15/wikimedia-engineering-moving-from-subversion-to-git/ Wikimedia Foundation], [https://www.eclipsecon.org/europe2013/tale-about-big-svn-git-migration EclipseCon proposed talk by Max Anderson], [https://groups.drupal.org/drupal-org-git-team Drupal], PostgreSQL, and Pentaho. Be sure to include the "before", the migration itself, and the "after" migration work.
 
<li> Understand the concept of Git repos
 
<li> Understand the concept of Git repos
 
<li> Know the caveats
 
<li> Know the caveats
Line 22: Line 22:
 
<li> A description for each repository (which will be visible in the web view)
 
<li> A description for each repository (which will be visible in the web view)
 
</ol>
 
</ol>
<li>Use/learn from recipes for LARGE migrations <ref>[https://github.com/maxandersen/jbosstools-gitmigration Max Anderson's recipe for migration of the JBoss Tools repos]</ref>
+
<li>Use scripted recipes for LARGE migrations <ref>[https://github.com/maxandersen/jbosstools-gitmigration Max Anderson's recipe for migration of the JBoss Tools repos]</ref>
 
</ol>
 
</ol>
 
<li> Importing your SVN history into Git
 
<li> Importing your SVN history into Git
Line 36: Line 36:
 
<li> [https://netbeans.org/kb/73/ide/git.html Netbeans natively supports Git] since v7.1
 
<li> [https://netbeans.org/kb/73/ide/git.html Netbeans natively supports Git] since v7.1
 
</ol>
 
</ol>
<li> Git Resources
+
<li> Establish Git Resources
<li> Git Task Force
+
<li> Create Git Task Force
 
<li> Update references in your product brochures, project documents, websites, systems, reference materials and procedure documents to reference the new systems.  This step can be ameliorated if in the beginning you reference code in a generic way such as "code.example.com" where you can then link to various aspects and implementations of your code systems; rather than naming them specifically based on technology or implementation.
 
<li> Update references in your product brochures, project documents, websites, systems, reference materials and procedure documents to reference the new systems.  This step can be ameliorated if in the beginning you reference code in a generic way such as "code.example.com" where you can then link to various aspects and implementations of your code systems; rather than naming them specifically based on technology or implementation.
 
</ol>
 
</ol>
  
 
== Caveats ==
 
== Caveats ==
A single Subversion repository almost always contains multiple "projects" - each with it's own 'trunk', 'branches' and 'tags'.  One thing you'll find moving from SVN to Git is that Git repositories aren't designed for multiple projects in the way that SVN is used. Separate projects in a single SVN repository should be moved to different Git repositories. So you'll want to split up a multi-project SVN repo when moving to Git. A tag or branch in a Git repository is always global to the repository -- so a good rule of thumb is "what makes semantic sense as a single version".
+
A single Subversion repository almost always contains multiple "projects" - each with it's own 'trunk', 'branches' and 'tags'.  One thing you'll find moving from SVN to Git is that Git repositories aren't designed for multiple projects in the way that SVN is used. All the separate projects (from a single SVN repository) should be migrated to separate Git repositories. A tag or branch in a Git repository is always global to the repository -- so split the code into repositories along boundaries that make sense semantically.  (Note that git has much better support for including library code into a project.  The feature is called "sub modules". Thus library code can be semantically split out into it's own repository, and that library can be re-used across multiple git repositories.  This is like svn "externals" only better.  
  
== Benefits ==
+
== Upside ==
git to git migrations are incredibly easy... at least for the core git repository functions. Just add another remote to push/pull.  This means that if you wish to change your git infrastructure to use a different system, the work involved will mostly be about the extra features bundled with the system (e.g. web viewer, code review, etc.) and integrations.
+
Once you've established a git infrastructure for version control, git to git migrations are incredibly easy... at least for the core git repository functions. Just add another remote to push/pull.  This means that if you wish to change your git infrastructure to use a different system, the work involved will mostly be about the extra features bundled with the system (e.g. web viewer, code review, etc.) and integrations.
  
  
 
{{References}}
 
{{References}}

Revision as of 17:33, 24 September 2015

A summary of the steps for migrating your version control system to git from subversion

  1. Discussions with stakeholders, project lead
  2. Leverage the resources and expertise of prior large migrations including Pro Git 2nd Ed. Eclipse Foundation, Atlassian, Wikimedia Foundation, EclipseCon proposed talk by Max Anderson, Drupal, PostgreSQL, and Pentaho. Be sure to include the "before", the migration itself, and the "after" migration work.
  3. Understand the concept of Git repos
  4. Know the caveats
  5. Plan and structure your Git space
  6. Decide what to do with your existing code
    1. Archive your current CVS or SVN repository
    2. Import your history into git
  7. Do the migration.
    1. Migrations must include at least the following details
      1. Migration timeline
      2. mapping of current code to new Git repos
      3. decision regarding existing code (archive or import)
      4. A description for each repository (which will be visible in the web view)
    2. Use scripted recipes for LARGE migrations [1]
  8. Importing your SVN history into Git
    1. Using svn2git on a remote server
    2. Using svn2git on build.eclipse.org
  9. Convert .svnignore to .gitignore
  10. Git Team Provider for Eclipse / Developer Tools setup / Client and End User configurations
    1. Add EGit to Eclipse
    2. Netbeans natively supports Git since v7.1
  11. Establish Git Resources
  12. Create Git Task Force
  13. Update references in your product brochures, project documents, websites, systems, reference materials and procedure documents to reference the new systems. This step can be ameliorated if in the beginning you reference code in a generic way such as "code.example.com" where you can then link to various aspects and implementations of your code systems; rather than naming them specifically based on technology or implementation.

Caveats[edit | edit source]

A single Subversion repository almost always contains multiple "projects" - each with it's own 'trunk', 'branches' and 'tags'. One thing you'll find moving from SVN to Git is that Git repositories aren't designed for multiple projects in the way that SVN is used. All the separate projects (from a single SVN repository) should be migrated to separate Git repositories. A tag or branch in a Git repository is always global to the repository -- so split the code into repositories along boundaries that make sense semantically. (Note that git has much better support for including library code into a project. The feature is called "sub modules". Thus library code can be semantically split out into it's own repository, and that library can be re-used across multiple git repositories. This is like svn "externals" only better.

Upside[edit | edit source]

Once you've established a git infrastructure for version control, git to git migrations are incredibly easy... at least for the core git repository functions. Just add another remote to push/pull. This means that if you wish to change your git infrastructure to use a different system, the work involved will mostly be about the extra features bundled with the system (e.g. web viewer, code review, etc.) and integrations.


References[edit source]