如何修改git存储库以在所有过去的修订版本中添加子模块? [英] How to modify git repository to add submodules in ALL the past revisions?
问题描述
我使用 git svn-clone
将我的SVN存储库与标签成功迁移到Git。但是, git svn-clone
不会迁移 svn:externals
。因此,我决定使用 git filter-branch
。
修改分支树。对于 svn :externals
,首先我为每个svn:externals创建了一个单独的Git存储库,然后尝试使用以下内容,但它无效。
$ git filter-branch --tree-filtergit submodule add git@github.com:myAcc / mySubmodule.git mySubmoduleHEAD
Rewrite a013a219e4294d4ee66b323cf1db9c170d90130a(1/4)致命的:工作树'。'已经存在。
将'git@github.com:myAcc / mySubmodule.git'克隆到子模块路径'common'失败
树过滤器失败:git submodule add git@github.com:myAcc / mySubmodule.git mySubmodule
rm:无法删除`c:/myRepo/.git-rewrite/revs':权限被拒绝
rm:无法删除目录`c:/myRepo/.git-rewrite':目录不为空
任何想法如何实现?
我认为你可以这样做,但也可以在清理方式:
$ b $ ol
svn :外部
s作为子模块并提交;注意此提交的SHA名称 git fetch
from临时资源库 git rebase<临时资源库中唯一提交的SHA>
I migrated my SVN repository successfully with Tags into Git using git svn-clone
. However, git svn-clone
does not migrate svn:externals
. Hence, I decided to modify branch tree using git filter-branch
.
For svn:externals
, first I created a separate Git repository for each svn:externals and then I tried using the following, but it didn't work.
$ 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
Any idea how to accomplish this? Thanks a lot in advance.
I think you could do it this way, but it may be possible to do it in a cleaner way:
- Create temporary empty git repository
- Add your
svn:external
s to it as submodules and commit; note the SHA name of this commit - Go into your old repository
git fetch
from the temporary repositorygit rebase <SHA of the only commit in the temporary repository>
这篇关于如何修改git存储库以在所有过去的修订版本中添加子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!