1

Here's the structure of my SVN repo:

  • http://server.net:8080/svn/CompanyName — svn root
  • http://server.net:8080/svn/CompanyName/ProjectBranch3 — current branch of the project
  • http://server.net:8080/svn/CompanyName/ProjectBranch2 — previous branch of the project
  • http://server.net:8080/svn/CompanyName/ProjectBranch1 — first branch of the project
  • http://server.net:8080/svn/CompanyName/SomeRandomProject — another project in the same root that I don't want to check out. There are lot of them
  • http://server.net:8080/svn/CompanyName/Tags/ProjectName/ — tags for the project

Project was developed as ProjectBranch1 at first, then copied into ProjectBranch2, and ProjectBranch3 in the end. I want to fetch the project with all of it's history, and I want git to understand that each branch started where previous one finished.

Now, the git init command has a -b option to specify a subfolder that is used for branches. However, the svn branches are not contained to a subfolder; as described above, they are located right in the root as individual sub-directories.

How can I configure git-svn to achieve this?

Max Yankov
  • 12,551
  • 12
  • 67
  • 135
  • Please don't mark this question as duplicate of this: http://stackoverflow.com/questions/572893/cloning-a-non-standard-svn-repository-with-git-svn this question is about a situation where all svn branches were contained in a single branch directory, every subdirectory of which is a branch. This is not the case here. – Max Yankov May 11 '15 at 08:27

1 Answers1

1

I was able to do it with the following .git/config file:

[svn-remote "svn"]
    url = http://server.net:8080/svn/CompanyName
    fetch = ProjectBranch3:refs/remotes/origin/trunk
    branches = {ProjectBranch1, ProjectBranch2}:refs/remotes/origin/bracnhes/*
Max Yankov
  • 12,551
  • 12
  • 67
  • 135