简体   繁体   English

'git svn clone'ing时保留复制的TAG的SVN历史记录

[英]Preserve SVN history of copied TAG when 'git svn clone'ing

I am migrating some SVN projects to git. 我正在将一些SVN项目迁移到git。

I want to clone a certain tag to its own git repository. 我想将某个标签克隆到自己的git存储库中。

By doing a git svn clone on the TAG path I loose all the history that happened before the svn copy, that created the tag in the first place. 通过在TAG路径上执行git svn克隆,我松开了svn复制之前的所有历史,该历史首先创建了标记。

Is there a way to preserve the original history in the new git project? 有没有办法在新的git项目中保留原始历史记录? (I can browse the SVN history in the IDE of my choice, so SVN seems to be able to provide the needed information) (我可以在自己选择的IDE中浏览SVN历史记录,因此SVN似乎能够提供所需的信息)

Reminder: I do NOT want a trunk project with branches and tags resembling the SVN structure. 提醒:我不希望带有类似于SVN结构的分支和标签的主干项目。 I want a separate project with just the TAG and all the history attached (including revisions before the tag creation) 我想要一个仅包含TAG和所有历史记录(包括标记创建之前的修订)的单独项目

check the --follow-parent flag: 检查--follow-parent标志:

 git svn clone --follow-parent https://path.to/svnroot/repo/tags/0.12

EDIT: 编辑:

note however, that git svn will only ever see content that is within the context of the cloned directory; 但是请注意, git svn只会看到克隆目录上下文中的内容; svn-tagging usually involves copying one directory to another location, so you need the entire directory tree (containing both the "trunk" and the final "tagX" director) in order to have enough context for git to work. svn-tagging通常涉及将一个目录复制到另一位置,因此您需要整个目录树(包含“ trunk”和最后的“ tagX”导向器),以便有足够的上下文使git起作用。 the reason for this is, that git will refuse to copy anything from/to a path outside the git-repository itself (which makes sense). 这样做的原因是,git将拒绝将任何东西从git-repository本身之外的路径复制到git-repository本身之外的路径(这很有意义)。 svn can see the entire history, since it really has the full context (on the server, even if you only have a partial checkout on your local machine) svn可以查看整个历史记录,因为它确实具有完整的上下文(在服务器上,即使您仅在本地计算机上进行了部分签出)

so, in order to have the full history into your git svn clone, you will probably indeed need to clone the entire project (that is, at least the directory that contains both the trunk and the tag-dir). 因此,为了将完整的历史记录保存到git svn克隆中,您可能确实确实需要克隆整个项目(也就是说,至少要同时包含主干和tag-dir的目录)。

so the way to proceed would be: 所以进行的方式是:

  • do a full git svn clone of your svn repository, with specifying the trunk/tags/branches directories ( --trunk , --tags and --branches flags if you have some special setup or use --stdlayout if your repo is organized in the standard /trunk, /tags/..., /branches/... way) 做一个完整的git svn clone你的svn库中,并可以指定主干/标签/分支目录( --trunk--tags--branches如果你有一些特殊的设置或使用标志--stdlayout如果回购在组织标准的/ trunk,/ tags /...、/ branches / ...方式)

  • this will give you a git repository with a number of git branches and git tags, where you can remove all the branches/tags you don't want (or just don't push them to a server) 这将为您提供一个带有多个git分支和git标签的git存储库,您可以在其中删除所有不需要的分支/标签(或不将其推入服务器)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM