How can I save my all local changes in SVN, revert them, and then restore them later?
2 Answers
The feature you describe is sometimes called shelving or stashing. Subversion does not offer it.
It's possible to simulate it with patches:
- You create a patch
- You revert changes
- You work on something else and commit
- You apply the previously created patch
Some editors like NetBeans can do it for you transparently. There're also third-party scripts.
Optionally, you can create a temporary branch, commit your pending changes there, switch back to previous branch and finally port changes back (svn merge
) when you're done.
Aside from raw Subversion, it's possible to have this feature with some of your helper tools. For example, TortoiseSVN has it and so do JetBrains IDEs like PhpStorm. Those are local features so they won't be visible in other Subversion clients, but they can work for you.

- 142,137
- 41
- 261
- 360
-
I would also note that step 4 can cause a conflict (it's very similar to a svn update). Not that that's a bad thing... – AlexMA Feb 12 '13 at 20:15
-
1
When you commit your changes, they are saved to a revision number. Save it to revert to it later.
Here is an answer to explain how to revert to older revisions:
How do I return to an older version of our code in Subversion?
-
I now how revert changes and how to commit my changes. But now after my changes i see that some unit test dont work and i want to check wether they were failed before my changes. So i want: 1) to save my changes. 2)revert original code and run unit tests 3)restore locally saved changes – Brans Feb 12 '13 at 15:24
-
When you commit your changes, they are saved to a revision number. Even if you revert to an older version of the code, you can always revert back to your most recent version (the one you just committed) – JoRouss Feb 12 '13 at 15:27
-
I don't want to commit changes for now... maybe there is an error - unit tests dont work and i dont know wether the problem in my code or it was before – Brans Feb 12 '13 at 15:36
-
Well just do a checkout of the version you want to test, test it and delete it? Like, in a new folder? – JoRouss Feb 12 '13 at 15:37
-
Yes i did so if i understand your right. But it is inconveniently because affected items are in different folders and the directory structure is very complicated... so manual coping takes much time – Brans Feb 12 '13 at 15:46
-
I see, but thats the only way i see. That and making a revision to save your changes, and then delete your new revision when your tests are made, I'm sorry I can't think of anything else. – JoRouss Feb 12 '13 at 16:00