https://torbjornzetterlund.com/wp-content/uploads/2016/01/git-960x600_c.png

Migrate from subversion to git easy guide


Today I been working on a project, to migrate subversion (often abbreviated svn) to git. git and svn are open source distributed software versioning and revision control system.

Git is a distributed version control system. So what does “distributed” actually mean? It means that instead of running ‘svn checkout (url)’ to get the latest version of your repository, with Git you run ‘git clone (url)’, which gives you a complete copy of the entire history of that project.

If you want to read the why and why nots between git and svn, check out this article why you should switch from subversion to git

The project I’m involved in, is to migrate svn software repositories to Github git software repository. There are other cloud services than Github that supports svn and git.

The main reason for this project is that Github is like a social network for programmers. You can look at what they’re working on and easily peruse their code and make suggestions or changes.

I do not get that with other cloud git services (what I’m aware off), with GitHub, all of the code is easily inspected, as is its entire history. Which lowers the barriers to collaboration. It’s easy to offer suggested changes to others’ code through github.

I’m at least aware of two ways you can migrate from svn to git

Do the migration using your laptop

Start by cloning your GIT repo

If you have created a github repo, then you can do the following.

git clone https://github.com//.git

(replace , with relevant details to your case)

Link the GIT repo to your SVN repo

cd git_project/

git svn init https://my_domain.svn..com/svn_project

(replace with relevant details of your svn service provider)

git svn fetch

Push your local GIT repo to your GitHub Repo

git push origin master

You could replace the origin with the https:// url to your repo on

GitHub svn import

The easiest way to migrate to GitHub is to use the GitHub svn import

To start you need to create a repo on Github, click new

Greenpeace-add-repo.png

Name the repository – I use the same name as I used for svn repository

Create_a_New_Repository.png

Click Create repository – you can also select the type of repository Public or Private.

Then at the bottom of the page, select import code, see the arrow in the image below

github_greenpeace_planet2.png

Get you svn url and enter it the field repository’s clone URL

Import_a_Repository.png

Next you will see a screen that ask you to login to your old svn repository, enter the login and password details. When authenticated the migration starts.

greenpeace_planet2__Importing.png

Then on your local environment you can just do a git clone

Conclusion

It’s straightforward, and should not take a long time.

That’s all, if you have any questions let me know by adding a comment below.

Menu