threads / discuss / 9323

git-svn and distributed git

Subject: git-svn and distributed git

## tl;dr

2 messages between Jul 31, 2007 and Jul 31, 2007.

replies: 1people: 1as markdown or json

Väinö Järvelä· Jul 31, 2007, 09:42 UTC · lore
Hello,

I have just started using git, so I don't have a lot of experience on it, and I also haven't used it in a distributed environment, just as a single developer on one of my personal projects.

Now I'm trying to use git at work through git-svn. git-svn cloned the Subversion repository okay, and using git and dcommitting to Subversion also works fine. The problems started when i tried to use the git-svn repository in a distributed fashion.

Here's the thing: I'm developing a server software, locally and on a pre-production server. The pre-production test server (just called the server for now on) is on a DMZ network, which cannot access our Subversion server. So I thought I could push the git repository to the server to update the code, which works fine too. But sometimes when there is a problem, I'll just develop the fix on the server itself, instead of on my laptop (local development). I would like to be able to pull the changes made on the server, back to my laptop, and dcommit it to the Subversion server from there.

The problem is, that git-svn changes all the commits, and pushing to the server repository won't work anymore. I can force a push, but then there will be two commits per every commit pulled from the server.

I have thought about using two branches on the server, master, which will only include commits already processed through git-svn, and dev, which is used to pull the "local" changes to be committed to Subversion. But my inexperience with git got me here, and I can't seem to be able to get any updates from the other branch. And I'm not even sure if this is the right approach to this problem.

What kind of approach/workflow would you use in a similar situation?

Regards, Väinö Järvelä

Väinö Järvelä· Jul 31, 2007, 12:31 UTC · re: Väinö Järvelä · lore

Re: git-svn and distributed git

On Jul 31, 2007, at 12:42, Väinö Järvelä wrote:
Show 6 quoted lines
> I have thought about using two branches on the server, master,  
> which will only include commits already processed through git-svn,  
> and dev, which is used to pull the "local" changes to be committed  
> to Subversion. But my inexperience with git got me here, and I  
> can't seem to be able to get any updates from the other branch. And  
> I'm not even sure if this is the right approach to this problem.

I got the branched situation to work. I was just pushing and pulling wrong when it didn't work. I guess I didn't understand the documentation well enough to fiddle around with remotes.

I got the branching to work with simple commands: server$ git push origin dev laptop$ git pull server dev laptop$ git-svn dcommit && git push server && git branch -r -d dev server$ git checkout master && git pull origin && git branch -D dev

But that's a lot of commands, am I still missing something with the branching?

Regards, Väinö

← back to recent threads