git-svn --ignore-paths

后端 未结 7 1606
悲哀的现实
悲哀的现实 2021-02-01 04:27

I\'m struggling for a number of hours now with the --ignore-paths option to git-svn, in an attempt to fetch only certain tags from a large repository.

I want to start

7条回答
  •  面向向阳花
    2021-02-01 04:59

    I'm posting this for everyone, who was aslo trying to use --ignore-paths for fetching only specific branches/tags...

    After a while struggling with --ignore-paths, which resulted in the following pattern to ignore all folders in branches folder, except folder branchname1 and branchname2:

    --ignore-paths='branches/(?!branchname1|branchname2)'
    

    Howerver, the correct solution is hiding at the bottom of the GIT SVN documentation:

    It is also possible to fetch a subset of branches or tags by using a comma-separated list of names within braces. For example:

    [svn-remote "huge-project"]
      url = http://server.org/svn
      fetch = trunk/src:refs/remotes/trunk
      branches = branches/{red,green}/src:refs/remotes/project-a/branches/*
      tags = tags/{1.0,2.0}/src:refs/remotes/project-a/tags/*
    

    So in your case, .git/config should contain something like this:

    tags = tags/{Acme-4.x,Acme-5.0,Acme-5.1,Acme-5.2,Acme-5.3,Acme-5.4}:refs/remotes/origin/tags/*
    

提交回复
热议问题