我如何使用 git-svn 来处理 svn 存储库的不同部分?

How can I use git-svn to work with disparate parts of an svn repository?

我有以下 svn 存储库结构:

branches
    branch-1
    branch-2
trunk
    system-a
        component-0
        component-1
    system-b*
        component-0
        component-1*
    shared*
    site_scons*
    SConscript*

我有一个团队需要开发 component-1system-b,但他们需要在本地使用 git,因为他们无法直接访问我们的 svn 服务器。 git-svn 似乎正是我要找的东西,因为它允许我创建他们的 git 存储库并通过 git svn dcommitgit svn rebase.[=25= 管理同步]

我可以使用 git svn clone https://svn-repo 轻松地为他们复制整个 svn 存储库,但这也会给他们 system-a 下的所有内容以及 system-bcomponent-1 以外的所有内容=].有几个不这样做的原因,其中最重要的是复制(并跟踪更改)大量不影响 system-b/component-1 团队的存储库是不明智的。

上面显示的带星号的目录是他们真正需要从中获取更新和进行更改的唯一目录。让他们不可能不小心更改他们不需要访问的内容也很棒。

如何使用 git-svn 完成此操作?我在想我可以创建几个单独的 git 回购协议,la:

git svn clone https://svn-repo/trunk/SConscript
git svn clone https://svn-repo/trunk/site-scons
git svn clone https://svn-repo/trunk/system-b/component-1
git svn clone https://svn-repo/trunk/shared

但这看起来和听起来会让 git 团队头疼,因为据我所知,这会创建四个实际上不同的 git 存储库。有没有办法使用 git-svn 在单个 git 存储库中拥有此 'sparse checkout' 结构?

好的,让我为您引用man page

--include-paths=<regex>

This allows one to specify a Perl regular expression that will cause the inclusion of only matching paths from checkout from SVN. The --include-paths option should match for every fetch (including automatic fetches due to clone, dcommit, rebase, etc) on a given repository. --ignore-paths takes precedence over --include-paths.

config key: svn-remote.<name>.include-paths