Search code examples
svnversioning

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


While programming software stored in a Subversion repo, I often modify some files, then notice that I'd like to do some preparatory change for my main work. E.g. while implementing new functionality, I notice some refactoring which might help me.

In order not to mix two unrelated changes, in these cases I'd like to "stow away" my changes, i.e. revert to the repository version, do some other changes, commit these, then "fetch back" my changes.

git-stash allows to do just that. Is there some way to do this with Subversion, either directly or with some plugin or script. Eclipse plugins would also be fine.


Solution

  • When I've got uncommitted changes from one task in my working copy and I need to switch to another task, I do one of two things:

    1. Check out a new working copy for the second task.

      or

    2. Start a branch:

      workingcopy$ svn copy CURRENT_URL_OF_WORKING_COPY SOME_BRANCH
      workingcopy$ svn switch SOME_BRANCH
      workingcopy$ svn commit -m "work in progress"
      workingcoyp$ svn switch WHATEVER_I_WAS_WORKING_ON_BEFORE
      

    I have some scripts that help to automate this.