Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to undo an svn update?

Tags:

svn

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.

like image 734
chmike Avatar asked Oct 08 '13 12:10

chmike


2 Answers

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
like image 57
ErichBSchulz Avatar answered Oct 27 '22 21:10

ErichBSchulz


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.

like image 38
Jan Hudec Avatar answered Oct 27 '22 22:10

Jan Hudec