简体   繁体   English

转换为git时保留SVN的历史记录并进行结构更改

[英]Preserve history of SVN with structure change when converting to git

I am working with an SVN which started out with all files tracked in the root of the folder. 我正在使用SVN,该SVN开始时在文件夹的根目录中跟踪了所有文件。 At some point, they began using the standard branches/tags/trunk structure, moving the working files to trunk so they could create branches and tags from it. 在某个时候,他们开始使用标准的branch / tags / trunk结构,将工作文件移动到主干,以便可以从中创建分支和标签。

I would like to convert this SVN into a git, maintaining the change history with some continuity across that move. 我想将此SVN转换为git,并在整个移动过程中保持一定的连续性。 When I use git svn clone with the -s option to convert the SVN tags and branches into git tags and branches, it does not grab the history of files in the root directory from the beginning of the SVN. 当我将git svn clone-s选项一起使用以将SVN标签和分支转换为git标签和分支时,它不会从SVN开头获取根目录中文件的历史记录。 Instead it treats the move into trunk as a mass add to master. 取而代之的是,它将进入主干的举动视为对主控的大量添加。

Is there any way to create a git that maintains both the old pre-trunk history, and also the newer branch and tag history? 有什么方法可以创建既可以保留旧的预干历史记录,又可以保留较新的分支和标签历史记录的git?

It's probably easier to import everything into Git first and then use filter-branch to do the history rewriting in Git after the fact. 首先将所有内容导入Git,然后在事后使用filter-branch在Git中进行历史记录重写可能更容易。 You may be able to do it with a git svn import/fetch up to the point where the structure changes, then edit the svn configuration and do an svn forwards from there. 您可以使用git svn import / fetch达到结构更改的程度,然后编辑svn配置并从那里进行svn转发。

However I'd do the git-only option, because git is far more powerful than svn and it would be easier to do the rewrites with git filter-branch after the fact. 但是我会做git-only选项,因为git比svn更强大,并且事后使用git filter-branch重写会更容易。

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

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