History of Git, Git-Submodule and SVN Server

First of all, I want to show you my project setup, I have two projects

  • Project X: cloned from a remote svn server with git svn clone
  • Project y: located on GitHub

Links of Project X Project y as a git submodule:

-- Project X -- src/ -- myCode1/ -- *Project y Submodule* -- myCode2/ -- .git/ -- ... 

Now I want to "push" local execution on a remote svn server with git svn dcommit .
Can someone explain to me the correct workflow for this project structure?


If I want to update the local git repository from the svn server, run git svn rebase and get the following:

Error. The following files of a broken tree tree will be overwritten with checkout

git lists all the files of the submodule, but I tracked the submodule already in my local repo.
Any ideas or suggestions?

+4
source share
1 answer

From my experience, git-svn does not work with Git submodules, mainly because of the way you submit changes to SVN: if you debug it a bit, you will find that it sends delta to SVN (therefore, pure Git concepts like submodule are not translated ), then it retrieves the just sent revision back (therefore, this revision does not contain submodules) and after all replaces the just sent commit with the extracted version (so that the submodule will be lost in this process at best, although in my experience this just does not work before). So if you can just have an unlit Project y Submodule directory and manage it manually, rather than as a submodule.

Alternatively, you can try SubGit as a replacement for git-svn. Starting with 2.0 EAP, it allows you to create a Git mirror for the remote SVN repository.

 $ subgit configure --svn-url http://svnhost/svnpath/projectX projectX.git $ #adjust projectX.git/subgit/{config,authors.txt,passwd} and, if possible, enable rev-propchange-hook in SVN repository $ subgit install projectX.git 

After that, you can clone projectX.git and work with it, as in a regular Git repository, synchronization will be performed automatically. Therefore, after installation, you add Project y Submodule as a regular Git submodule of project X.git.

 $ git submodule add git://github.com/.../projectY.git projectY $ git commit -m "Added projectY as submodule" $ git push 

The only thing you need to do is make sure that there is no file or directory with the same name in SVN or that it will not overwrite the submodule.

+2
source

All Articles