Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using git submodules in a git-svn project

In our git-svn managed project, we have 3 upstream projects that are all kept in native git repositories on GitHub. Since the source code of those upstream projects is under our control and changes frequently, our current solution, namely re-deploying the build artifacts to the super-project everytime we change something is quite cumbersome.

What I'd like to have is this:

parent project (git-svn):
    --> submodule 1 (git)
    --> submodule 2 (git)
    --> submodule 3 (git)

That way, the source code for submodules 1-3 is compiled along with the sources for the super project, but I can push changes to submodules separately.

The question is: what happens when I git svn dcommit on the parent project? Does this even work?

UPDATE Hm, I just set up a simple project structure, trying to resemble this scenario, and I receive this error message when trying to dcommit on the superproject:

a0301b11f3544a1e71067ff270eded65e4c8afbd doesn't exist in the repository at /opt/local/libexec/git-core/git-svn line 4775
Failed to read object a0301b11f3544a1e71067ff270eded65e4c8afbd at /opt/local/libexec/git-core/git-svn line 574

Any ideas/suggestions?

like image 466
Matthias Avatar asked Dec 23 '10 14:12

Matthias


People also ask

Can you use Git and SVN together?

git-svn is a specialized tool for Git users to interact with Git repositories. It works by providing a Git frontend to an SVN backend. With git-svn, you use Git commands on the local repository, so it's just like using normal Git. However, behind the scenes, the relevant SVN commands are sent to the server.

Are Git submodules a good idea?

Git submodules may look powerful or cool upfront, but for all the reasons above it is a bad idea to share code using submodules, especially when the code changes frequently. It will be much worse when you have more and more developers working on the same repos.

How do I clone a repository in SVN?

# Clone a repo with standard SVN directory layout (like git clone): git svn clone http://svn.example.com/project --stdlayout --prefix svn/ # Or, if the repo uses a non-standard directory layout: git svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/ # View all branches and tags you have ...

What are Git submodules used for?

Git submodules allow you to keep a git repository as a subdirectory of another git repository. Git submodules are simply a reference to another repository at a particular snapshot in time. Git submodules enable a Git repository to incorporate and track version history of external code.


1 Answers

You can't do this, git submodules can't be pushed upstream into a svn repository via git-svn, it doesn't support this.

like image 62
cbz Avatar answered Oct 04 '22 14:10

cbz