Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I revert back to a previous SVN commit?

Tags:

file

linux

unix

svn

Suppose I'm at revision 50. But, I want to revert back to revision 45, and commit back as the stable version.

How do I do that, in the most simple way?

  1. What if I want to do that with one file?
  2. What if I want to do that with the entire repository?
like image 950
TIMEX Avatar asked Jul 01 '10 06:07

TIMEX


People also ask

How do I revert to a previous commit in svn?

Right click on the selected revision(s), then select Context Menu → Revert changes from this revision. Or if you want to make an earlier revision the new HEAD revision, right click on the selected revision, then select Context Menu → Revert to this revision. This will discard all changes after the selected revision.

What is svn revert option?

svn revert will revert not only the contents of an item in your working copy, but also any property changes. Finally, you can use it to undo any scheduling operations that you may have performed (e.g., files scheduled for addition or deletion can be “unscheduled”).

How do I find my svn revision history?

To find information about the history of a file or directory, use the svn log command. svn log will provide you with a record of who made changes to a file or directory, at what revision it changed, the time and date of that revision, and, if it was provided, the log message that accompanied the commit.

What is reverse merge svn?

Reverse merge In SVN SVN will keep common file contents in working copy from the specific revision of file and HEAD revision of working copy. if it is folder level. In SVN reverse merge, if not file found in the specific revision, it keeps the working copy as it is.


2 Answers

I'm not sure what you mean by "commit back as the stable version", but depending on what you're trying to accomplish I recommend:

svn update -r45
This will rebase your working copy at revision 45.

or:

svn merge -c -50,-49,-48,-47,-46
This will update (by reverse-merging) your working copy by removing all the changes between 45 and 50. Now if you make changes and commit, it will be like you have removed 46-50 from the repository and made the HEAD revision (51?) to be r45 + your change.

like image 127
William Leara Avatar answered Oct 14 '22 17:10

William Leara


Reverse merge those revisions that you want to undo. This can be done on one or multiple files. By reverse merging, your working copy gets changed to the state without that revision, which you then can commit.

like image 39
Sjoerd Avatar answered Oct 14 '22 16:10

Sjoerd