Skip to content

southgate/git-svn-scripts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-svn-scripts

Bash scripts to help instrument a reasonable workflow with git svn

Inspiration

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

Contributors

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

Setup

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

Feedback

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

About

Scripts to implement a nice workflow with git svn

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published