2

我使用标签成功地将我的 SVN 存储库迁移到 Git 中git svn-clone。但是,git svn-clone不迁移svn:externals。因此,我决定使用git filter-branch.

对于svn:externals,首先我为每个 svn:externals 创建了一个单独的 Git 存储库,然后我尝试使用以下内容,但它不起作用。

$ git filter-branch --tree-filter "git submodule add git@github.com:myAcc/mySubmodule.git mySubmodule" HEAD
Rewrite a013a219e4294d4ee66b323cf1db9c170d90130a (1/4)fatal: working tree '.' already exists.
Clone of 'git@github.com:myAcc/mySubmodule.git' into submodule path 'common' failed
tree filter failed: git submodule add git@github.com:myAcc/mySubmodule.git mySubmodule
rm: cannot remove `c:/myRepo/.git-rewrite/revs': Permission denied
rm: cannot remove directory `c:/myRepo/.git-rewrite': Directory not empty

知道如何做到这一点吗?提前非常感谢。

4

1 回答 1

1

我认为您可以这样做,但可以以更清洁的方式进行:

  1. 创建临时空 git 存储库
  2. 将您svn:external的 s 作为子模块添加到其中并提交;记下此提交的 SHA 名称
  3. 进入您的旧存储库
  4. git fetch从临时存储库
  5. git rebase <SHA of the only commit in the temporary repository>
于 2010-07-21T15:41:00.367 回答