I'm developing a project in Git. IT depends on another project, that's in a Subversion repository. I'd like to be able to make changes to the Subversion project in the tree, and commit to/update from the Subversion repository from within the Git project. Is that possible?
One of the remaining cool things that Subversion does is called "externals." It's a way to point at a specific branch or directory in another svn repository. You can even pin it down to a specific version of a specific directory. Externals are really darn nifty, and would solve this problem in an instant, as changes made in an externals directory are automatically pushed back to the source when doing a commit.
Externals is also something missing in git. Git has submodules, but they don't work in the same way, in that they're tied to a specific commit. This effectively means that there's no native solution to the problem of having "nested" repositories that can be read and written to at the same time and remain perfectly in sync, no less nested repositories using different backends.
If you don't want to do the submodule revision pinning dance, there's another workaround.
Git has decent svn emulation in the
The accepted answer was simply using
Another option entirely would be looking at Mercurial's subrepositories, which can host both git and svn. I'm not sure if you really want to go three levels deep.
Are you just looking for
Assuming by depends you mean dependency:
You can put any kind of repo inside a git repository without problems. e.g.
And then manage
You can also then do this:
In that case, updates you make to files in
If you use
As an aside: from experience keeping a git and svn project in sync is generally quite problematic unless one or the other is read-only.
While Charles seem to think that
Depending on when and where you have updated your working copy, directories at different points in your
If you want to update a submodule, you have to update it and then make a new commit to the super-module to update it to use the new revision in the submodule. It means submodules are less flexible than externals, but it enforces the primary
If you want
Incidentally, as far as I understand it, Mercurial subrepositories work in the same way as Git submodules, so that won't help either.
Git has an svn wrapper. Here is a quick run-down: Effectively Using Git With Subversion