Scripts to implement a nice workflow with git svn, influenced heavily by Rein Henrichs’ post entitled hack && ship.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Bash scripts to help instrument a reasonable workflow with git svn


These scripts are influenced heavily by Rein Henrichs’ post entitled hack && ship.


Many thanks to Tanner Donovan for pairing with me on these scripts.


To use these scripts:

  • Edit g-init to point to your SVN repository
  • Ensure these scripts are available in your $PATH

Typical Workflow

  • Initialize a git repository, based on your SVN repo
    • $ g-init
      • This is done only once
  • Make a feature branch:
    • $ g-branch branchname
      • This updates master from SVN trunk, creates a branch branchname and switches to that branch
  • Go about your business, commit early and commit often
  • Merge-out from SVN trunk via the master git branch, to keep nice and fresh:
    • $ g-update
  • When the time is right, ship that feature branch back to SVN
    • g-ship
      • This uses g-update to ensure your feature branch is fresh
      • This squashes commits made in your feature branch, keeping a tidy single commit message per feature branch merge
      • This requires that your tests all pass, by default (See source for overriding option)

Patch-based workflow

Sometimes you may find yourself working with collaborators that do not have commit access to the trunk of your SVN repository. This simple workflow uses patches to submit and accept changes from git feature branches.

  • Follow the workflow outlined above, right up until shipping the feature branch. g-ship will fail if you do not have write access to SVN trunk.
  • Create a patch to represent the changes made in your feature branch:
    • $ g-create-patch
      • This uses g-update to ensure a fresh feature branch
      • branchname.patch is created as output, which can be sent via email or attached to a ticket
  • A developer with commit rights to the SVN repo can then apply the patch:
    • $ g-apply-patch branchname.patch
      • This updates master from SVN and creates a branch matching branchname (the basename of the patch file)
      • The patch is applied to the feature branch
      • After you have approved the changes, you can ship them via g-ship


I’m very open to feedback on the general workflow presented here, as well as the specific implementation in git. Fork away!