tags:

views:

423

answers:

2

Our svn repository has lots of branches that are branches off of sub-trees. This works OK with svn because I can check out that sub-tree in the correct spot in my working copy. However, if I check out the same branch using git, I get a working copy with only the branch sub-tree. Is it possible to make git relocate the branch so that my working copy structure is identical whether I am on trunk or a branch?

I realize that our svn practices clash with git's philosophy of always working on the whole tree. How do people deal with this?

+1  A: 

I've never used svn like this, and if the silence you've gotten is any indication then it's kind of a rare practice. Could you give some rationale for doing things this way, maybe by describing what problem it solves? That way we can better judge what would be an acceptable solution.

Peter Burns
I think it's a bad practice, actually. It's just what we do, but it mostly creates problems and confusion. Anyway, the subtree merging strategy seems to help me make it right on the git side.
Knut Eldhuset
+3  A: 

If possible, fix it on the server side: Subversion doesn't copy data when branching (svn copy), it just hardlinks, so there's really no obvious reason to branch out only a subtree.

If that's not feasible, you should have a look at http://blog.nuclearsquid.com/gits-subtree-merging-strategy -- it may do the trick, but I haven't tried it myself. He's basically describing an alternative to git submodules, where you just automatically merge the remote (in this case your Subversion branch) into a subdirectory instead of the root directory of the repository.

Daniel Schierbeck
The subtree merging strategy did the trick.
Knut Eldhuset