git svn clone except a particular folder

git, git-svn, svn, version-control

Solution

You can use the `--ignore-paths=<regex>` option to `git svn init` or `git svn fetch`, or add the config option `svn-remote.<name>.ignore-paths` to `.git/config`. This is documented as "This allows one to specify a Perl regular expression that will cause skipping of all matching paths from checkout from SVN." Search the manual for "ignore-paths" for more details.

After trying the experiment in this answer, I learned that the regex appears to be applied to the full path of each directory or file from the repository root. Therefore, if you have a standard repository layout and want to exclude the same thing from each trunk/branch/tag, you can use a regex like `^(trunk|((branches|tags)/[^/]+))/(<file-to-ignore>|<other-file-to-ignore>)(/|$)`.

Problem

I want to git clone an svn repository except for one folder in the root folder of svn. How do I do it? I could do `git svn clone svnrepo/dir/sb-dir/` if I needed only `sb-dir` but I need all folders (and files) within the `dir` except the `design` folder

Original source

Related problems