A co-worker of mine commented that Tortoise has an easy way to export out the diff between two revisions and wondered if there was an easy way to do this on his mac. I replied “well you could write a script to parse an svn diff”. So here it is, ready for you to snag from github.


Instructions attached below from the README in github.

This file is designed to export the files that were modified or added between two svn revisions. It will output a corresponding zip file with the directory structure intact. Useful for when you need to push code but the server you are pushing to doesn’t have access to your repository.


It is reccomended that you set this to executable and add it to your path in your .profile (otherwise you will have to copy it to each repo)


OSX is not required but, it is a requirement that “svn” and “zip” are installed in the OS.


cd [/repo_root]

export_changes.rb 1550:1560

Produces: 1550_1560.zip

8 Responses to “Export SVN Changes to zip file”

  1. Lorenz Says:

    Hi Steven,

    thank you very much for sharing this very useful script. That’s just what I was looking for. It seems that currently not one of all the graphical SVN-clients for the Mac support this kind of feature – which I cannot understand. It is so essential if you are a developing a PHP based website – where it is total overkill to export & upload the whole repository each time you have made some small changes.

    Do you think it would be possible to create an automator action, that I could start by right-clicking the SVN-project-folder in the finder and it will put up an dialogue box for letting me enter the input parameter?

    Thanks again and best regards, Lorenz

  2. Smithson Says:

    It appears that this is less of an issue with Git than SVN. Git only puts a .git folder in the repository root, whereas SVN puts a .svn folder in every subdirectory. So “svn export” avoids recursive command-line magic, whereas with Git recursion is not necessary.

  3. Steve Ross Says:

    Lorenz – I guess I could do that but, I’ll leave it up to the reader! I have the terminal open all day so I really don’t find it to be an issue however, if you want an easier method you can always drag the directory that you want to run the command in (from the finder) to the terminal so you can cd to it and then run the ruby file.

  4. Lorenz Says:

    Hey Steve,

    thanks for the hint. I didn’t know about that ‘drag to terminal’-capability. I like my Mac more and more each day… I’m also really comfortable with your script by now. It really helps me a lot. So thanks for that!

    But still I’m considering using Platypus which serves as an application wrapper for scripts. Looks pretty interesting – so I might give it a try when I find the time.

  5. Steve Ross Says:

    Smithson – too true, loving git more and more each day. Just moved the main project I am working on these days into it and already seeing why everyone raves about it.

  6. Scott Says:

    Great script that solves a glaring issue SVN should support natively.

    I forked it on GitHub and made one minor change to it: after a few too many accidental commits of the generated .zip to SVN (since it was being saved to the docroot of the project), I modified it to save the .zip to the user’s Desktop instead.


  7. U Shaped Kitchen Designs Says:

    Transitional: This theme fuses the crispness of traditional themes without the complexities and intricacies, and in doing so, bring together the new and the old into functional styles. The 12V lighting system requires a number of components to be connected, so it is wise to find a good electrician for the job. Now with the modern kitchen interiors one can do a complete makeover to the obsolete and conventional kitchen.

  8. batman arkham knight download Says:

    I’m no longer certain the place you’re getting your information, but good topic. I needs to spend some time finding out more or understanding more. Thanks for wonderful info I was searching for this information for my mission.

Leave a Reply