Reputation: 169
Is it possible to fetch specific directories using git svn? I am trying to fetch multiple directories that match a name "XYZ" in "trunk/Path". "XYZ" is in multiple paths.
git svn init --stdlayout --no-minimize-url --trunk=trunk/Path
git svn fetch --revision 1234:HEAD --authors-file=authors.txt --include-paths="^.*trunk\/subdirpath1/XYZ"
git svn fetch --revision 1234:HEAD --authors-file=authors.txt --include-paths="^.*trunk\/subdirpath2/XYZ"
git svn fetch --revision 1234:HEAD --authors-file=authors.txt --include-paths="^.*trunk\/subdirpath3/XYZ"
Upvotes: 2
Views: 4828
Reputation: 38136
Yes, you can fetch specific directories. Detail steps as below:
.git/config
.Open the .git/config
file add include-paths = /path/to/specify
under [svn-remote "svn"]
. So the config file will look like:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[svn-remote "svn"]
include-paths = subdirpath1/XYZ|subdirpath2/XYZ|subdirpath3/XYZ
url = https://url/for/svn/repo
fetch = trunk:refs/remotes/origin/trunk
branches = branches/*:refs/remotes/origin/*
tags = tags/*:refs/remotes/origin/tags/*
Note: paths for include-paths
should contains all the path you want to fetch. Such as if there has the directory trunk/subdirpath4/XYZ
, you should also add it in config
file.
--include-paths
option for git svn fetch
:git svn fetch --include-paths="subdirpath1/XYZ|subdirpath2/XYZ|subdirpath3/XYZ"
Then it will fetch the related svn revisions.
Upvotes: 3