How can I save my all local changes in SVN, revert them, and then restore them later?
Asked
Active
Viewed 3,286 times
2 Answers
6
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.
Álvaro González
- 135,557
- 38
- 250
- 339
-
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
-
0
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