A rail bridge near Copenhagen Denmark

Migrate from subversion to git easy guide

Today I have 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 not 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 of), 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)

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 asks you to log in 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.


Posted

in

, ,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *