我正在尝试使用git svn
将SVN仓库中的单个目录克隆到Git仓库中。
如果我使用git svn clone svn+ssh://path/to/repo/trunk/directory
,我将得到一个Git仓库,但该仓库没有源SVN仓库中包含的分支。
如果我使用git svn --stdlayout svn+ssh://path/to/repo/trunk/directory
,我将得到一个空的Git仓库。以下是命令的输出:
Initialized empty Git repository in /directory/.git/
Using higher level of URL: svn+ssh://path/to/repo/trunk/directory => svn+ssh://path/to/repo
W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found: revision 100, path '/trunk/directory'
W: Do not be alarmed at the above message git-svn is just searching aggressively for old history.
This may take a while on large repositories
我曾经阅读到解决上述问题的方法是添加一个修订版本范围,例如-r 1000:HEAD
,但这仍然会产生一个空的库。输出为:
svn: E160013: '/path/to/repo' not found
Initialized empty Git repository in /directory/.git/
Using higher level of URL: svn+ssh://path/to/repo/trunk/directory => svn+ssh://path/to/repo
有什么方法可以使用git-svn克隆SVN存储库的子目录,同时仍然获取源SVN存储库中的所有分支和标签吗?
--branches
参数中使用通配符。很好。 - Stephen Harrison--branches
和--tags
参数。只需要使用--trunk=...
而不是--stdlayout
就可以正常工作。 - Nux