Temporarily put away uncommitted changes in Subversion (a la "git-stash")

You can store your current changes with svn diff into a patch file, then revert your working copy:

svn diff > stash.patch
svn revert -R .

After you’ve implemented your preparatory feature, you can then apply your patch with the patch utility:

patch < stash.patch

As others have noted this will not work with svn:properties and tree operations (add, remove, rename files and directories).

Binary files could also give problems, I don’t know how patch (or TortoiseSVN in this case handles them).


This blog post advises using diff and patch.

  • git stash approximately becomes svn diff > patch_name.patch; svn revert -R .
  • git stash apply becomes patch -p0 < patch_name.patch

Note that this doesn't stash metadata changes or (I think) directory creates/deletes. (Yes, svn tracks those separately from directory contents, unlike git.)

Tags:

Svn

Versioning