tags:

views:

54

answers:

1

Hello everyone, I'm using git for quite some time now, mainly git-svn. Now I want to convince my colleagues to switch from svn to git. But unfortunaly the precondition is that the svn repository keeps on living quite a time. So I searched for an solution an came up with the book:

Jon Loeliger's "Version Control with Git" I bought it and it is really good but I don't fully understand the guide to set up a git svn gatekeeper repo.

In Chapter 16, he describes a situation in which there is a Subversion repository, and at least a couple users that want to be using Git. He proposes a single "gatekeeper" git repository which is the only interface to subversion. After git svn cloneing the subversion repo (with --prefix=svn/), all the branches are then pushed to a bare repository (git push ../svn-bare.git 'refs/remotes/svn/:refs/heads/svn/', and other git users are told to clone this repo, which now contains local branches of all the svn remotes.

This part works and It think if fully understand it. But I don't get the next part:

If a developer that clones the bare repository pushes changes back from his repo to the bare repository and then I dcommit this in the bare repo to svn, the commits the user pushed are lost for good reason because of the replaced commits git-svn creates. Or am I wrong? How does this work?

The book says

Then, to merge back to subversion, in the gatekeeper repo, you do

git checkout svn/trunk (or other branch - this is checking out a detached head as svn/trunk is a remote) git merge --no-ff new-feature git svn dcommit

How can I checkout a branch in bare repository? I don't think this works

This results in a merge commit on a detached head, and then the modified commit (after the git-svn-id line is added) is put on the real svn/trunk branch.

What is meant by real svn/trunk ?

The commit on the detached head is "worse than redundant. Using it for anything else eventually results in conflicts. So, just forget about that commit. If you haven't put it on a branch in the first place, it's that much easier to forget" (Jon Loeliger).

I'm a little confused. Has someone a better explanation for creating a git svn gatekeeper repo? I have searched the web and this site but I don't found anything that seams suitable for me

Big thanks in advanced. I'm so tired of wasting so many time with svn branching and merging, when collaborating with my colleagues....

+1  A: 

I don't think you should ever push changes back to the bare repo. I've got an example setup here that you could try out:

http://blog.tfnico.com/2010/10/gitsvn-5-centralized-git-svn-mirror.html

In my setup (which I've been employing for 3-4 months without any problems), changes should always "flow" through the SVN repository. I don't really understand this gatekeeper technique..

Thomas Ferris Nicolaisen