Git-svn - 导入完整历史

标签 git svn git-svn

问题

默认情况下,git svn clone 仅从分支创建开始导入历史记录,尽管事实上,文件历史记录在分支创建之前存在于 SVN 存储库中。

如果重要的话,我们的 SVN 分支是由 svn copy 创建的。

我的尝试

我试过 --no-minimize-url--follow-parent,但没有成功。生成的 Git 存储库与没有这些参数的情况相同,从分支创建开始。

想要的结果

具有 SVN 存储库创建的完整历史记录的 Git 存储库。

更新

我的实际命令行是

git svn clone http://svnserver/repo/dir1/dir2/project

有用的是 -T 参数和结果命令:

git svn clone http://svnserver/repo/ -T dir1/dir2/project

最佳答案

By default git svn clone imports history only from branch creation onwards, despite the fact, that history for files is present in svn repository prior branch creation.

是的。那是真实的。 git svn 只有在被告知时才会尝试将分支导入为分支。来自 git-svn 的联机帮助页:

When cloning an SVN repository, if none of the options for describing the repository layout is used (--trunk, --tags, --branches, --stdlayout), git svn clone will create a git repository with completely linear history, where branches and tags appear as separate directories in the working copy.

如果您将一个分支的 URL 传递给 git svn clone(而不是顶级 URL),您将只会获得该分支的线性历史记录。这可能就是您所看到的。

如果您想要完整的历史记录,请使用上面提到的存储库布局选项,并传递顶级 URL。然后 git svn 将尝试为 SVN 分支创建 git 分支,并尝试为它们提供正确的历史记录,回到它们创建之前。

请注意,这将为您提供包含所有分支的完整存储库。如果您只想要一些分支,则需要按照联机帮助页中的说明修改您的配置:

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/branches/*
               tags = tags/{1.0,2.0}/src:refs/remotes/tags/*

参见 git-svn(1) .

关于Git-svn - 导入完整历史,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15163916/

相关文章:

基于 SHA 的 git pull

Git 在写入我正在 pull 的文件时给我一个 "Permission Denied"错误

file - svn合并: source under renamed folder not merged

git:svn不是git命令-Mac

通过 ssh 克隆 Git,通过 https 推送

regex - 如何在多个subversion存储库中搜索文件内容?

svn - 学习如何使用 Subversion

svn - 如何使用 git-svn 跟踪仅限本地的更改/更改集?

Git:添加错误添加第二个github帐户 "ssh: Could not resolve hostname github-secondUser"

git - 推送到远程 :org. ajoberstar.grgit.exception.GrgitException 的问题: