User Tools

Site Tools


dev:miker-git-svn

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.esilibrary.com/home/evergreen/evergreen-equinox

    or

    $ git remote add eg-esi git://git.esilibrary.com/git/evergreen-equinox.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://svn.open-ils.org/ILS
              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

Profit!

dev/miker-git-svn.txt · Last modified: 2011/02/22 22:45 by miker

© 2008-2017 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a member of Software Freedom Conservancy.