TheBrowser
TheBrowser

Reputation: 31

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:

Now, our current trunk is at:

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:

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

This time git-svn does not find any commit.

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

Upvotes: 3

Views: 259

Answers (1)

ChrisA
ChrisA

Reputation: 606

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.

Upvotes: 1

Related Questions