Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git-2-SVN migration?

Yes, I know. Why would you want to migrate from Git to SVN?

Well I happen to be in a situation that I need to migrate a huge Git repo to Subversion! Here's one workflow I tried per Edwin's comment:

first create a local SVN repo: svnadmin create svn_repo

Next I check out my Git repo: git clone git:myNameSpace/myProject

cd into the myProject and run:

git svn init -s --prefix=svn/ file:///home/myHome/svn_repo/myProject

git svn fetch

git rev-list --parents master | grep '^.\{40\}$' to look up the hash of your root commit and gives only one commit as it should.

Next is to get the hash of the empty trunk commit: git rev-parse svn/trunk

This one unfortunately fails with:

fatal: ambiguous argument 'svn/trunk': unknown revision or path not in the working tree. Use '--' to separate paths from revisions

Well I can't go much after this....

like image 400
Reza Toghraee Avatar asked Apr 04 '12 15:04

Reza Toghraee


1 Answers

I would recommend you to migrate that with SubGit in several easy steps.

$ svnadmin create svn.repo
$ subgit configure svn.repo
$ nano svn.repo/conf/subgit.conf #edit path to your (bare!) Git repository (you may use "git clone --bare <URL> bare.git.repo" if you don't have it locally)
$ subgit install

That's all. While translation SubGit will try to preserve all commits (even temporary), branches, merges, ignores, dates, EOLs settings, tags and so on, as it it possible.

After translation the repositories will be in sync (each push to Git is translated to SVN revision and vice versa). To break synchronization (if you don't need it) run

$ subgit uninstall svn.repo
like image 60
Dmitry Pavlenko Avatar answered Sep 18 '22 17:09

Dmitry Pavlenko