gitgit-svnversion-control-migrationsvn2git

SVN to git migration only creates .git folder


I am trying to migrate from svn to git. I tried doing so using the following tools

git-svn
svn2git

However both tools only created a .git folder, without checked out files and folders (speaks a working copy).

With git-svn I tried to execute the following

git svn clone REMOTE_SVN_REPO
svn2git REMOTE_SVN_REPO

What exactly am I doing wrong?

p.s. I tried googling but all the blogs claim that both of these commands should have made a local repository with all the files and folders. Also once I'd converted svn project to mercurial project using hg convert. After converting svn project to mercurial project I'd done hg up or something like that which brought all files and folders of the project and I could easily push that project to the mercurial server. Here All I have is a .git folder . What step am I missing or what exactly am I doing wrong?


Solution

  • Well, git svn is a git backend for remote SVN repositories. You may consider it as a two way proxy - internally it emulates SVN commands and allows its user use a given SVN repository as if it was a GIT repository. For the rest of the world the user still uses SVN, GIT in this case is used as just a handy wrapper over SVN.

    Thus with git-svn you get in .git folder a personal mirror of all commits from the SVN repository (or just part of it, if you selected some commits with -r option or selected some branches). You may inspect the whole set of imported commits with gitk --all command and check out a selected commit with git checkout or just with the RMB click on a commit in gitk and choose the appropriate menu item.

    Now you're supposed to first commit your changes locally (just as you do with an ordinary GIT repository) and then push the changes back to the SVN repository with git svn dcommit. During the push to the SVN repo the commits will be "re-played" as if the were done by a usual SVN client. There could be conflicts and other problems of that kind as with a usual SVN commit. Use git svn fetch, git svn rebase and other commands described in the git svn --help page to rebase your changes to the updated tree and resolve conflicts

    On the other hand svn2git is a way to convert an existing local SVN repository (i.e. content of SVN commit database) into a local GIT repository. Usually this step is performed once when a whole team or company decides to completely migrate from SVN to GIT. After the conversion you'll actually get all the benefits of GIT (complex branching and merging, eleborate GIT-specific systems for code-reviewing* etc)