2

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.

shadangi
  • 23
  • 3
  • 1
    Don't forget `git submodules` are not exactly an equivalent of `svn:externals`: http://stackoverflow.com/questions/3131912/why-are-git-submodules-incompatible-with-svn-externals/3132221#3132221 – VonC Jul 21 '10 at 15:02
  • Thanks for the caveat. I overlooked the fact that `git submodule` actually points to a commit. Not sure in this case, it is an option for me. I want to point the submodule to HEAD every time one updates. – shadangi Jul 28 '10 at 22:26

1 Answers1

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>
svick
  • 236,525
  • 50
  • 385
  • 514
  • 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 Jul 28 '10 at 22:24
  • AFAIK, a submodule always points to a particular commit, you can't point to to HEAD. – svick Jul 29 '10 at 11:05