SVN2GIT - An easy guide of migration

SVN2GIT - An easy guide of migration

Hi,

I have recently spent some time trying to migrate several SVN repositories to GIT. 

Atlassian has its own tool of migration but it needs more steps than SVN2GIT to migrate a repository and that's why I chose the latter in the first place.

In this article I will present the steps that I followed to successfully migrate several repositories from one platform to another.

  1. Generate the authors.txt file.
  2. Copy the authors.txt file to your local .git folder.
  3. Open Command Prompt, navigate to your .git folder and run this command if your repo doesn’t follow the classic structure (/tags, /branches, /trunk):


 svn2git <svn_repo_url> –rootistrunk –authors authors.txt

   4. If your repo does follow the classic structure then you can choose to exclude the tags and branches folders to save time and disk space:

svn2git  <svn_repo_url> –notags –nobranches –authors authors.txt

   5. Go to the remote GIT server and create a new remote repository.

   6. Then you need to configure GIT for the first time and push the local changes to the remote repository. Check if all the authors and the history of commits have been moved to the new repository.


N.B.: The GIT repository should remain as read-only until the whole team switches to GIT for all the projects.

If multiple SVN commits are performed after the migration please follow these steps to easily synchronize both repos:

  1. Open Command Prompt
  2. Go to your local GIT repository.
  3. Run this command to import all the recent SVN commits into the local GIT repository:
svn2git –rebase

4. Run this command to push all the changes to the remote repository:

git push origin master

 


If you want to also find out about the issues I've encountered during migration you can check this article on my blog.



To view or add a comment, sign in

More articles by Andrei Petrut

Others also viewed

Explore content categories