为什么 git svn 会创建新分支,我该如何解决?

Why is git svn making new branches and how can I fix?

我的团队同意从 svn 迁移到 git。所以我创建了一个存储库 xxwin 然后我 运行 类似这样的东西:

git svn clone --stdlayout --no-metadata --authors-file=users.txt svn://hostname/path xxwinRepository
cd xxwinRepository
git remote add origin https://bitbucket.org/xxxxx/xxwin.git
git push

花了很长时间,但似乎工作正常。

然后一位开发人员说他在迁移后对 svn 进行了更多更改。

我想我可以 运行

而不是重新启动
git svn fetch
git push

它似乎把所有东西都推到了新的 b运行ches 上。不幸的是,在我意识到发生了什么之前,这种情况发生了几次。现在我们有数百个 b运行ches..

例如,我们在 svn 中有一个名为 v2_5_working 的 b运行ch,现在在 git 中有一个名为 origin/v2_5_working [=15] 的 b运行che =] xxwin/xxwin/origin/v2_5_working

有什么方法可以轻松合并所有这些 b运行ches 吗?如果有下一次有没有办法让它合并为 git svn fetch?

的一部分

您在 git svn clone 命令中使用了 --no-metadata 标志。这意味着创建的 git 提交没有任何 link 对应的 svn 提交,并且 git 不知道开发人员对 svn 所做的新提交应该放在最前面git.

中的某个分支

如果您打算进行一次性转换,请仅使用 --no-metadata,如果继续在 svn 上开发则不要使用。引用 documentation:

This gets rid of the git-svn-id: lines at the end of every commit.

This option can only be used for one-shot imports as git svn will not be able to fetch again without metadata. Additionally, if you lose your $GIT_DIR/svn/*/.rev_map. files, git svn will not be able to rebuild them.

The git svn log command will not work on repositories using this, either. Using this conflicts with the useSvmProps option for (hopefully) obvious reasons.

This option is NOT recommended as it makes it difficult to track down old references to SVN revision numbers in existing documentation, bug reports and archives. If you plan to eventually migrate from SVN to Git and are certain about dropping SVN history, consider git-filter-branch1 instead. filter-branch also allows reformatting of metadata for ease-of-reading and rewriting authorship info for non-"svn.authorsFile" users.