views:

63

answers:

1

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 [email protected]:myAcc/mySubmodule.git mySubmodule" HEAD
Rewrite a013a219e4294d4ee66b323cf1db9c170d90130a (1/4)fatal: working tree '.' already exists.
Clone of '[email protected]:myAcc/mySubmodule.git' into submodule path 'common' failed
tree filter failed: git submodule add [email protected]: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.

A: 

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>
svick
Actually, it doesn't sound that bad esp. when one is try to migrate SVN repo to Git. Since you don't do it again and again. But now, my main problem lies with git-submodule itself. I want to point my submodule to the HEAD of that module and not to a particular commit. Any insight?
shadangi
AFAIK, a submodule always points to a particular commit, you can't point to to HEAD.
svick