How to modify git repository to add submodules in ALL the past revisions?

北战南征 提交于 2019-12-06 09:58:24

问题


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.


回答1:


I think you could do it this way, but it may be possible to do it in a cleaner way:

  1. Create temporary empty git repository
  2. Add your svn:externals to it as submodules and commit; note the SHA name of this commit
  3. Go into your old repository
  4. git fetch from the temporary repository
  5. git rebase <SHA of the only commit in the temporary repository>


来源:https://stackoverflow.com/questions/3300626/how-to-modify-git-repository-to-add-submodules-in-all-the-past-revisions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!