简体   繁体   English

是否可以将SVN分支转换为新的GIT仓库?

[英]Is it possible to convert an SVN branch into a new GIT repo?

Our organization never used Trunk, and simply created new SVN branches for each version. 我们的组织从未使用过Trunk,只是为每个版本创建了新的SVN分支。 Is it possible to simply select the most recent branch, and create a new Git repo of that branch (with history)? 是否可以简单地选择最新的分支,并创建该分支的新Git仓库(具有历史记录)?

Yes, you can simply choose to clone only one branch from the SVN repo: 是的,您只需选择从SVN仓库中仅克隆一个分支:

git svn clone http://svn.example.com/project/mostRecentBranch

This will create a git repo with a single branch, which represents the history of "mostRecentBranch" from the SVN repo. 这将创建一个带有单个分支的git仓库,它代表SVN仓库中“mostRecentBranch”的历史记录。

git svn will try to also include history from before the branch's creation (ie the history of the branch that "mostRecentBranch" was copied/created from). git svn将尝试在分支创建之前包含历史记录(即从“mostRecentBranch”复制/创建的分支的历史记录)。 However, this may not work if the branch was not created properly in SVN (ie if it was not created using "svn copy"). 但是,如果在SVN中未正确创建分支(即,如果不是使用“svn copy”创建分支),则这可能不起作用。

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

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