简体   繁体   中英

Setting up git-svn to follow a non-standard svn repo

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?

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/*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM