How to Easily Migrate from SVN to Git

Allison Bokone
Allison Bokone
·
Last updated on May 28, 2024

Migrating your projects from SVN to Git can seem like a daunting task. You’re likely worried about potential data loss and disrupting your workflow. The pressure is on because the benefits of Git—more flexible workflows and improved collaboration—are hard to deny.

However, a migration from SVN to Git is straightforward when you use built-in git commands or open source utilities. Read through this overview and then choose a method to use for your migration. 

Follow the links in the sections below to review the details and finalize your repo mappings and migration plan. Then, learn how Assembla can provide side-by-side support during your transition.

Use git svn to migrate SVN to Git

git svn is a command you can use to sync changes bidirectionally between SVN and Git. Migrating source control can be a labor-intensive process that requires careful planning and coordination across multiple teams. Sometimes in these scenarios, it’s necessary to migrate in phases, which can leave teams working in both systems during the migration process. While not ideal, git-svn can help your team keep changes in sync across both systems until the migration is complete.

According to the git-svn documentation:

git svn can track a standard Subversion repository, following the common "trunk/branches/tags" layout, with the --stdlayout option. It can also follow branches and tags in any layout with the -T/-t/-b options (see options to init below, and also the clone command).

Once tracking a Subversion repository (with any of the above methods), the Git repository can be updated from Subversion by the fetch command and Subversion updated from Git by the dcommit command.

git svn clone Command

Use the git svn clone command, which runs the init and fetch commands, and include the SVN URL as an argument to create a git directory based on the SVN URL and then fetch each SVN revision to make a git commit to your local repository, recreating the change history. If your SVN repo has a large history this operation may take a long time or hang. If that happens, you can kill the process and run git svn fetch to pick up the fetch from where it left off.

If you need to pull the latest changes from SVN later on, you can use git svn fetch to get changes from SVN without applying them to your local branch, or git svn rebase to apply the changes on top of the commits in your local branch. 

If you need to push git changes back to SVN use git svn dcommit – which will also rewrite your git commit.

Convert SVN to Git with svn2git

svn2git is a command line utility that guides you through the process of ensuring your SVN directory aligns with your Git repository before it uses git-svn to clone the repository. svn2git does clean up work to ensure branches and tags are correctly imported. It also makes sure that your git repository matches what is in your master branch once the migration is complete.

To learn more about these and other options for SVN to git migration, see Subversion to Git Migration – GitHub Cheatsheets.

Git and SVN Repos on Assembla

When it comes to source code management, Assembla offers a unique advantage: the ability to host both Git and SVN repositories. This dual support allows for a more flexible and integrated development environment, making it easier to manage legacy projects in SVN while transitioning to or working simultaneously with Git. When it comes to deploying, this means only one connection (FTP or SSH) needs to be made.

Additionally, Assembla’s project management tool seamlessly integrates with both Git and SVN repositories. This provides a centralized platform for tracking progress, managing tasks, and collaborating with your team, enhancing your overall productivity and project visibility. With Assembla, you get a comprehensive solution that supports your source code management needs and helps you maintain a cohesive workflow during and after your migration from SVN to Git.

How to create a new repo in Assembla

Easy. Start by creating a Space, if you don’t have one already. Then simply select “Create with repository”. The next window asks you to choose the type of repo you want. Choose Git or SVN (Perforce will also be available here if you’re on the Perforce Cloud plan), name it and create an empty repository.

Create new Space Repo How to Easily Migrate from SVN to Git

Then, you’re ready to start working with your repo. Connect via SSH or HTTPS to an existing repo or start from scratch.

Start working with your repo How to Easily Migrate from SVN to Git

Relate Tickets to both SVN and Git Commits

An Assembla Space comes with a robust project management tool. Go to Cardwall or Ticket List and start creating the tickets you need. Conveniently, Git or SVN commits can be related to the same ticket. This can help your team ensure nothing gets lost in the transition from SVN to Git.

To do this, simply add re #ticketnumber to your commit messages. Learn more about linking commits to tickets.

aPkLTG OXESFTG2AllqZW93rNOQbBSNb6l r2S7vXbpS jTiFQk oAozXLC vGUnVnLVj4izchT1wmcQPwJl6g6udwf6iuq6Sj55bSI0EY4 jfNR1Fe0GG2p5RWAV How to Easily Migrate from SVN to Git
Try Assembla
Streamline your workflow with our integrated source code and project management platform.
No Credit Card Necessary
Get Source Code Management Tips in Your Inbox
The reCAPTCHA was invalid. try it again.
By filling and submitting this form you understand and agree that the use of Assembla website is subject to the General Website Terms of Use. Additional details regarding Assembla collection and use of your personal information, including information about access, retention, rectification, deletion, security, cross-border transfers and other topics, is available in the Privacy Policy.
Allison Bokone
Allison Bokone
Allison Bokone is an instructor at Miami University in Ohio for the Computer and Information Technology department, specializing in process and DevOps. Prior to teaching, Allison worked at Microsoft for 18 years, first as a Technical Writer, then as a Program Manager and Director at Xbox. In her last role she was a regular contributor to MicrosoftGameDev.com.

Comments are closed

© 2024 Assembla - All Rights Reserved

Select AWS Region

Pick the region closest to your team for faster performance.

Select AWS Region

Pick the region closest to your team for faster performance.