I had modified files in my working directory and did an svn update. The update was performed without conflicts.
I would like to be able to revert the working directory content to the state it was just before the svn update.
The reason is because I maintain a local git repository in parallel to the shared svn repository. I forgot to git commit my local changes before doing the svn update. Now my working directory contains local changes mixed up with changes resulting from the svn update. If I commit, all changes will appear as one atomic change. I wished they would be separate. If I could revert the update and preserve the content of the working directory I had before the svn update, I could do that.
I keep hitting this question, and it doesn't actually include the simple answer to the "How to undo an svn update?" question.
So for the benefit of others, with the solvable case where you just wish to roll back an update:
First check the log with:
svn log | less
This will give you the revision number (eg 957
) that you wish to go back to. Then:
svn up -r 957
It's not possible. The state before update is forgotten.
You can separate the changes by making subversion diff, using git apply
to apply it to index, commit that (your changes) and than commit everything (the changes from pull).
That is emergency solution. I suggest you switch to git-svn
, that will handle this kind of things for you in future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With