A complete idiot’s guide to git-svn-migrate

3 steps to batch convert Subversion to Git

If you read my previous post about converting Subversion repositories to git, you’ll know that to do a proper Subversion-to-Git transformation on a batch of repositories is going to take some time (what with all that command line typing). I had 142 legacy project Subversion repositories lying around I wanted converted to Git and, since I’m lazy, I pulled on my bash boots and wrote me a script to do the work!

With the git-svn-migrate scripts I wrote, you can batch convert all of your Subversion repositories in just 3 steps. And I’ve GPLed them and put them on GitHub if you’d like to collaborate and improve them; see the git-svn-migrate project page.

svn boxes go into the factory; git ponies come out.
git-svn-migrate: a reverse glue factory

0. Download the git-svn-migrate scripts

This isn’t really one of the 3 steps, but obviously you need the scripts. You can either download the latest official release from GitHub or you can get the most recent development release by cloning the repository:

git clone git://github.com/JohnAlbin/git-svn-migrate.git

1. Create a list of Subversion repositories to convert

Create a file called “repository-list.txt” with one Subversion URL per line:

svn+ssh://example.org/svn/awesomeProject
file:///svn/secretProject
https://example.com/svn/evilProject

With this format the name of the project is assumed to be the last part of the URL. So these repostitories would be converted into awesomeProject.git, secretProject.git and evilProject.git, respectively.

If the project name of your repository is not the last part of the URL, or you wish to have more control over the final name of the Git repository, you can specify the repository list in tab-delimited format with the first field being the name to give the Git repository and the second field being the URL of the Subversion repository:

awesomeProject    svn+ssh://example.org/svn/awesomeProject/repo
evilproject     file:///svn/evilProject
notthedroidsyourlookingfor  https://example.com/svn/secretProject

With this format you can use any name for the final Git repo. In the first example above, we’re using the second-to-last part of the URL instead of the last part of the URL. In the second example, we’re just changing the name to all lowercase (recommended). And in the final example, move along. Move along.

2. Create a list of transformations for Subversion usernames to Git committers

Using the repository list created in step 1, run the fetch-svn-author.sh script to create a list of unique usernames for all the commits in your repositories. The output of the script should be redirected to a file.

./fetch-svn-author.sh --url-file=repository-list.txt > author-transform.txt

Edit the raw list of Subverions usernames to provide full names and emails suitable for Git committers. The output of the fetch-svn-author.sh script will be of the form:
username = username <username>
You should edit each line to be:
username = Full name <email>

For example, change:
jwilkins = jwilkins <jwilkins>
into:
jwilkins = John Albin Wilkins <john@example.org>

3. Convert the Subverion repositories into bare Git repositories

This is the easiest step. To place all of your new bare Git repositories in /var/git, simply run:

./git-svn-migrate.sh --url-file=repository-list.txt --authors-file=author-transform.txt /var/git

This may take a while. (My 142 repos took about 6 hours to convert.) But you’ll see the progress as the underlying git-svn pulls commits out of all of your Subversion repositories.

Enjoy!

Comments

I just started working with git. Though, it is pretty safe against corruption and all, it is somewhat hard to follow. Git svn migration is painful when you are not thorough with git in the first place. But your three step conversion is totally idiot proof. A life saver it is. Even though it took me quiet a few days to figure it out completely, in the end it was worth it. And hey where can I find an idiot proof tutorial to git?! Mark

I can't thank you enough for these scripts. After several unsuccessful tries w/ svn2git (which lost commits!), git-svn-migrate did the job of converting the Minify SVN repo nicely.

I had problems using this with an HTTPS-based SVN repo, as git-svn doesn't support a non-interactive password prompt. Problem was solved by making a small script which simply does: echo 'password', and running as follows:

GIT_ASKPASS=$PWD/askpass ./git-svn-migrate.sh --url-file=repolist.txt --authors-file=userlist.txt /var/git

Downside is it means (at least temporarily) storing your password on disk, but you can always shred the file later.

These kind of post is always inspiring and I prefer to read quality content so I happy to find many good point here in the post, writing is simply great, thank you for the post. johnny @ Best Running Shoes For Women

You are really helpful. Not everybody can explain such a complicated topic in a way that a complete idiot can understand.

The novel is something that could be material to be analyzed, however usually the novel is a book that has the nature of fiction. However, not all documents are part of that is consistent with fact. Here is my Website for all Zauberer of the big world. Look!

I am really impressed by this blog! Very clear explanation of issues is given and it is open to everyone sd memory cards

I see a lot of people have some things to say about it in their remarks. I Would like to see more being wrote about it that's for sure.I will surely return often. garmin nuvi 1450lmt gps

Will gonna try to follow your instruction very careful since it's technical on my part! LOL, I know it's not that hard for some people but I'm not that really familiar on conversion. So this really make sense for the beginner.
Ben Brandes

The conversion and steps you have presented is cool. Someone that has the capabilities of producing other's need and queries of how to do the git-svn-migrate conversion. Thanks! Hawaiian Island

Using script is one of the best to way to put some coding for any design you wanted to look like in a particular website. Good thing is that it also worked in conversion to make more easier and better. FusionHQ

If the project name of your repository is not the last part of the URL, or you wish to have more control over the final name of the Git repository, you can specify the repository list in tab-delimited format with the first field being the name to give the Git repository and the second field being the URL of the Subversion repository

dog snuggie

When the task brand of one's archive isn't the very last section of the Web address, otherwise you need with additional hold in the ultimate title from the Git archive, it is possible to identify the particular library checklist within tab-delimited structure while using initial area staying the actual brand to present the actual Git library and also the next discipline getting the actual Link to your Subversion archive
How to unlock iPhone
ipad vs laptop

Congratulations for the post, though it's a little scary to know that we are governed by this gang trying to take away what little we have left: the freedom of communication and sharing.franchising awards

Very good points you wrote here..Great stuff...I think you’ve made some truly interesting points. Keep up the good workwanko

After viewing the video and the pictures I can surely say that I learn something from this website. All the effort your have put into building this site is not a waste for sure.
cyprus company registration
tax planning

The first time I find your site I immediately liked this blog. That’s nice to come back here.coolest books

Howdy would you mind letting me know which web host you're using? I've loaded your blog in 3 completely different web browsers and I must say this blog loads a lot quicker then most. Can you suggest a good web hosting provider at a reasonable price? Thanks a lot, I appreciate it! houston staffing agencies

I'm curious to find out what blog platform you happen to be working with? I'm having some small security problems with my latest website and I'd like to find something more secure. Do you have any suggestions? tinka megabol

This is also a very good post which I really enjoyed reading. It is not everyday that I have the possibility to see something like this.Orlando Audio Visual

Hey there, There's a lot of Kebap Restaurants in Istanbul Personally. i Love Gunaydin Kebap,kebaps are very delicious. Stuff is so kind, place isvery cleanAlso you can ask Kosebasi Kebap, Tike or...

However, it really is quite safe and sound towards problem and many types of, it really is relatively unpleasant. Git svn migration is actually distressing when you find yourself certainly not complete along with git to begin with. Your a few phase the conversion process is entirely tech-leery evidence. Such submit is obviously uplifting and i also would rather study good quality articles i really pleased to discover a lot of very good stage within your article, creating is merely fantastic, we appreciate you your submit. Woodworking Plans

Pretty insightful post. Never thought that it was this simple after all. johnny @ Noise Cancelling Headphones Review. Furthermore, I had spent a good deal of my time looking for someone to explain this subject clearly and you’re the only one that ever did that.

Oh! So that is how it should go? Well, thank you for posting this one out. I have been doing a lot of research about this one.

Best regards,
Chris of bible covers

Thanks a lot for the effort of posting this kind of article. Very nice.

This is a very informative article.I was looking for these things and here I found it.I am doing a project and this information is very useful me.I have been searching for this quality blogs regarding this niche
מתווכים

Searching in Yahoo drove me here, I just found this kind of satisfactory readings i was looking for.I had bookmarked this website to avoid missing it again
ייעוץ משכנתא

I enjoyed reading your posts. It seems that you all have good ideas about communicating with your children and grandchildren. And that is great to see how positive you all are with them
פרויקטים חדשים

I really like the way you put the information in this post. I can relate in some other ways.

i Love Gunaydin Kebap,kebaps are very delicious. Stuff is so kind, place isvery cleanAlso you can ask Kosebasi Kebap,

Eventhough this subversion conversion to git requires a good knowledge and skill about urls and their presentation,its detailed step by step description has enable people to understand.

expunge criminal record

the script was awesome thank you for the code i really appreciate your post live cricket enjoyed the blog.

Though the strategy is regularly criticized by experts in the field, it is being used under the guise of implicit analogies tacitly approved by those at the top.Chicago cleaning services

Though the strategy is regularly criticized by experts in the field, it is being used under the guise of implicit analogies tacitly approved by those at the top.Chicago cleaning services

Nice knowledge gaining article. This post is really the best on this valuable topic. anime mobile

That is not so bad to think about this guide of git svn migrate. Thanks.
french doors

Sure pleased that I discovered that site by accident. I’ll probably be subscribing for your feed so that I will get the most current updates. Like the information here. Mobilkraner

Making your blog a public spot is great! I learned a lot and I am sure I will learn more since I am also into finance and currently studies it as well.

Best regards,
Chris from Bible Games

Awesome, I've been waiting for this for quite a while now. Reading it with baited breath.

i was searching for this info and finally found it here ... a very comprehensive guide to covert Subversion to Git

awesome i was searching for this only .nice way to convert subversion to git

Nice blog having nice information. some times we ignore this sort of things & also suffer a lot as well. However we can save a lot with the assistance of these tips for example time transcend memory cards

I see a lot of people have some things to say about it in their remarks. I Would like to see more being wrote about it that's for sure.I will surely return often. baby strollers

Add new comment