working with git-svn (was ...)

John Ralls jralls at
Mon Jul 1 17:41:11 EDT 2013

On Jul 1, 2013, at 1:59 PM, Derek Atkins <derek at> wrote:

> John,
> On Mon, July 1, 2013 3:03 pm, John Ralls wrote:
>> On Jul 1, 2013, at 10:18 AM, Derek Atkins <derek at> wrote:
>>>> Why don't you just set up the intermediate repo?
>>> What's the point?  It just adds more work for me.  It means I have to
>>> run
>>> the git-svn update, git pull, and then git-update scripts every time I
>>> want to update a WC repo.
>> Consider what you have to do if you don't have an intermediate:
>>  cd master-repo
>>  git checkout branch-to-work-on
>>  git svn rebase //So that you're working on the latest rev
>>  git checkout some-other-branch // This is so you can push back from the
>> WC; Git won't let you
>>                                                            // push to a
>> checked out
>> branch
>>  cd WC
>>  git pull --rebase
>>  // do work
>>  git commit
>>  git push
>>  cd master-repo
>>  git checkout branch-to-work-on
>>  git svn dcommit
> Why can't I:
> ( cd master-repo && git-svn-mirror )
> git clone --local -b <branch> master-repo branch-wc
> cd branch-wc
> ...
> git-update
> (do work)
> git commit  (do I need to do this? -- I'm guessing I do)
> git svn dcommit

That's what I'm suggesting. Note that git-svn-mirror can push to a
bare repo, but won't if one isn't specified with --git-repo. Git svn 
operates on a working repo, and git-svn-mirror uses git svn
(via the perl API that's part of git) to fetch from the SVN repo. As long
as you always dcommit from your WC and use git-update to keep the refs pointed
in the right place, it should work fine. The bare repo thing is there just to
be able to work with Github or Gitolite. Git-svn-mirror will whine if there's
nothing to push to, but it will still work OK.

>> Granted, you can script a lot of that, but it's still more work than
>> having an intermediate maintained with
>> git-svn-mirror from on your home network
>> and updated via a commit
>> hook or a cron job. Then you can git-update; git-svn-dcommit in each WC as
>> needed without having to be
>> bouncing between the git-svn-master and the WC for every batch of commits.
>> Your laptop can have a
>> mirror clone of the intermediate just as you're planning for Gnucash in
>> order to consolidate fetches.
> What does git-svn-mirror do specially, beyond what a git svn fetch would
> do in a "pull-only" repo?  I'm asking because I do not know exactly how
> the existing git-svn repo is pulled/updated at work (yes, there is on). 
> So *theoretically* I could clone --mirror that one similarly to how I'd
> work with the gnucash tree, but I'd only do that if I could dcommit back
> without causing issues.  And honestly I don't know how to test that
> without actually doing a commit.

Git-svn-mirror's main job is to deal with the different way tags
are handled in SVN and git: In SVN they're really branches, and in git they're
just references. Git svn makes them git branches, then git-svn-mirror turns
the tag branches into git tags. That works much better when you're using
a git visualizer like gitk -- as long as nobody commits changes to a tag, which
is fine with SVN but will cause trouble with git. 

As long as you dcommit back, the repo at the office won't be able to tell whether
you committed with SVN or git. Do use git-update even if the office repo isn't
changing the SVN tags into git tags (git update doesn't actually do anything with
that) it will help keep your git svn pointers working correctly.

More information about the gnucash-devel mailing list