Table of Contents
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)
- Init your git
$ mkdir ~git/ILS $ cd ~git/ILS $ git init $ git config branch.autosetupmerge true
- Pick a git mirror of the official svn repository. There are several.
- 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
- 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
- Create your topic branch
$ co -b fun_stuff eg-esi/master
- Do fun_stuff
- Commit said fun_stuff
$ ci -a -m 'it really was fun'
- Lather, rinse, repeat
Sharing is caring
- 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
- 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.
- Let others see you junk
$ git push eg-esi fun_stuff
Can't think of anything witty for "merge" ... so, How To Merge
- Update your svn stuffs
$ git svn fetch
- Update your git stuffs
$ git pull
- 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}
- Actually push your changes
$ git svn dcommit
Profit!