From svn to git, with a moved trunk

I’m trying to switch my svn repository to git. It’s an old repository, and one of the previous maintainer moved the trunk for each new release. For example, the previous repository was at:

  • svn+ssh://svn.mycompany.com/project/release_1/trunk

Now, our current trunk is at:

  • svn+ssh://svn.mycompany.com/project/release_N/trunk

When I checkout the SVN second repository, I’ve the full history, including before the copy. However when I git-svn the second repository, I don’t have the old history (from release_1, …). The first commit is the copy of release_{N-1} to release_N/trunk.

Here is what I tried:

  • git svn clone –no-minimize-url –authors-file my-authors-file svn+ssh://svn.mycompany.com/project/release_N/trunk my_project.git

Since this does not work, I tried something else. Let’s assume that the ‘copy commit’ is K, I tried:

  • git svn clone –no-minimize-url -r BASE:K –authors-file my-authors-file svn+ssh://svn.mycompany.com/project/release_N/trunk my_project.git

This time git-svn does not find any commit.

Do you know if there is a magic trick to have the full history ?

  • Maintain and automatically update a file containing current revision
  • Overcome git svn caveats
  • Migrate huge SVN repo with common trunk to Git
  • Can I import from SVN to Git without connecting to a remote server?
  • What is a VCS repository?
  • “git svn rebase” without changing the current branch
  • In SVN how do I override automatic Windows domain authentication
  • What makes some version control systems better at merging?
  • One Solution collect form web for “From svn to git, with a moved trunk”

    This is what I’ve understood by the question:
    You have your history spread across several svn branches (which happen to all be called trunk).
    You would like all of this history when moving to git.

    I think the following will fix your problem:

    git svn init my_project.git
    
    git config svn-remote.svn.url svn+ssh://svn.mycompany.com/project
    git config svn-remote.svn.fetch release_N/trunk:refs/remotes/trunk
    git config svn-remote.svn.branches */trunk:refs/remotes/*
    git config svn.authorsfile my-authors-file
    
    git svn fetch
    

    This will create the release_N branch as trunk, and the remaining releases as different branches in your git repository.

    As far as I know, you can’t get one git svn branch to point at multiple urls, which is what I think you were trying to do.

    Git Baby is a git and github fan, let's start git clone.