User Tools

Site Tools


NOTE: This is a workflow for committers. The good news is that non-committer git-svn is simpler still!

First, some helpful bash aliases

Adjust to taste, of course, but

alias show='for i in `git remote show`; do git remote show $i; done'
alias dif='git diff'
alias co='git checkout'
alias ci='git checkin'
alias branch='git branch'
alias status='git stat'
alias upall='for i in `branch|colrm 1 2|grep -vf ~/.dead-git-branches`; do co $i; git pull; done'

That last once is extra-fancy – just branch names you no longer want to work with in ~/.dead-git-branches to ignore them forever more

Rely on the kindness of strangers

In this case, I'm relying on the kindness of Bill Erickson who set up ESI's git mirror (sync'd every 3 minutes, IIRC)

  1. Init your git
    $ mkdir ~git/ILS
    $ cd ~git/ILS
    $ git init
    $ git config branch.autosetupmerge true
  2. Pick a git mirror of the official svn repository. There are several.
  3. Add it as a read/write remote
    $ git remote add eg-esi git+ssh://


    $ git remote add eg-esi git://

    for read-only. Then grab it:

    $ git fetch eg-esi
  4. Add the svn repo for dcommit'ing
    • Put this in your .git/config
      [svn-remote "svn"]
              url = svn://
              fetch = trunk:refs/remotes/trunk
              branches = branches/*:refs/remotes/*
              tags = tags/*:refs/remotes/tags/*
    • Grab it
      $ git svn fetch

      (WARNING: this takes about 4 hours. There are other ways to do it, but this is the simplest I've found)

Get to work

  1. Create your topic branch
    $ co -b fun_stuff eg-esi/master
  2. Do fun_stuff
  3. Commit said fun_stuff
    $ ci -a -m 'it really was fun'
  4. Lather, rinse, repeat

Sharing is caring

  1. Make sure you're up to date
    $ git pull

    It should know where to pull from, but if git gets confused use

    $ git pull eg-esi master
  2. Optionally, interactively rebase to squash away some of your commits
    $ git rebase -i HEAD~`git log --oneline master..|wc -l`

    This rebases the entire commit stream since branching including upstream merges, so beware! In particular, only squash the commits in your local branch, not merged from upstream … seriously, don't.

  3. Let others see you junk
    $ git push eg-esi fun_stuff

Can't think of anything witty for "merge" ... so, How To Merge

  1. Update your svn stuffs
    $ git svn fetch
  2. Update your git stuffs
    $ git pull
  3. Test pushing your changes up
    $ git svn dcommit --dry-run

    You can use the tree-ish output from that to check your changes

    $ dif {hash}^1 {another hash}
  4. Actually push your changes
    $ git svn dcommit


dev/miker-git-svn.txt · Last modified: 2022/02/10 13:34 by

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.