Reverting single file in SVN to a particular revision

svn revert file to revision
svn delete revision
svn revert to revision command line
svn undo update
svn undo add
svn revert skipped
subversion rollback revision
svn get a specific revision of a file

I have a file as shown below in an SVN repo that I would like to revert to a previous version. What is the way to do this in SVN? I want only downgrade this particular file to an older version, not the whole repo.


$ svn log
r179 | xx | 2010-05-10

Change 3
r175 | xx | 2010-05-08

Change 2
r174 | xx | 2010-05-04


If you just want the old file in your working copy:

svn up -r 147

If you want to rollback, see this "How to return to an older version of our code in subversion?".

Roll back (Undo) revisions in the repository, If you want to undo all changes you made in a file since the last update you If you want to undo all the changes which were committed in a particular revision,  This will undo all files of the revision than simply revert those file you don't like to undo. Don't forget the dash (-) as prefix for the revision. svn revert File1 File2 Now commit the changes back.

svn cat takes a revision arg too!

svn cat -r 175 mydir/myfile > mydir/myfile

Undo Changes, Reverts any local changes to a file or directory and resolves any conflicted states. working copy, svn revert requires you to explicitly provide at least one target. If you read the description of the questions, it seems like he was looking for how to revert a single file, not entire directory. – thestar Oct 29 '14 at 15:27 2 I believe all this does is destroy your working copy by 'reverting' it back to head. Or to which ever was checked out. confirm by doing svn update -r VER file, then do an svn revert.

svn revert filename 

this should revert a single file.

svn revert, I use tortoisesvn on my windows PC as a windows shell/explorer extension. I was maintaining a *.c source file in svn. One of my colleague made some changes on​  Revert a single file: Right-Click -> TortoiseSVN -> Show log; Find the revision/changeset you want to rollback to (i.e. the revision just before the change you want to remove) Right-click on the single file in the list of files -> Revert to this Revision; Revert the entire changeset: Right-Click -> TortoiseSVN -> Show log.

For a single file, you could do:

svn export -r <REV> svn://host/path/to/file/on/repos file.ext

You could do svn revert <file> but that will only restore the last working copy.

How to revert a file to older revision in SVN, To rollback a specific file, just delete the one in your working copy and then run update to replace it with the one in the repo. by Ben on 2010-04-22 22:45:19. For​  If you use the Eclipse IDE with the SVN plugin you can do as follows: Right-click the files that you want to revert (or the folder they were contained in, if you deleted them by mistake and you want to add them back) Select " Team > Switch " Choose the "Revision" radion button, and enter the revision number you'd like to revert to.

So far all answers here seem to have significant downsides, are complicated (need to find the repo URI) or they don't do what the question probably asked for: How to get the Repo in a working state again with that older version of the file.

svn merge -r head:[revision-number-to-revert-to] [file-path] is IMO the cleanest and simplest way to do this. Please note that bringing back a deleted file does not seem to work this way[1]. See also the following question: Better way to revert to a previous SVN revision of a file?

[1] For that you want svn cp -r [rev-number] [repo-URI/file-path]@[rev-number] [repo-URI/file-path] && svn up, see also What is the correct way to restore a deleted file from SVN?

How to revert (roll back) to a previous revision with Subversion, To restore a file to the latest updated svn version, i.e. undo the local changes, you can use revert : svn revert file. To restore a file to an older version (revision  Reverting single file in SVN to a particular revision (9) I have a file as shown below in an SVN repo that I would like to revert to a previous version. What is the way to do this in SVN? I want only downgrade this particular file to an older version, not the whole repo. Thanks.

svn, svn commit // merge my working copy into the repository, making a new version. File foo was Updated (received changes from the server). A foo Copy one of the temporary files on top of your working file. Only run svn resolved when you'​re certain that you've fixed the conflict in your file - once the temporary files are  By far the easiest way to revert the changes from one or more revisions, is to use the revision log dialog. Select the file or folder in which you need to revert the changes. If you want to revert all changes, this should be the top level folder. Select → to display a list of revisions.

Using svn revert, Reverting a File or Folder to BASE. To revert a modified file to a pristine copy of its BASE revision: Select the files or folders in the working copy browser which  I don't know if there's a one-liner that will revert a single file to the contents of 5 commits ago, but the lo-fi solution should work: checkout master~5, copy the file somewhere else, checkout master, copy the file back, then commit.

Reverting Changes - Cornerstone Mac Subversion, revert - Reverting single file in SVN to a particular revision. I have a file as shown below in an SVN repo that I would like to revert to a previous version. What is  svn merge -r head:[revision-number-to-revert-to] [file-path] est IMO le moyen le plus propre et le plus simple de le faire. Veuillez noter que ramener un fichier supprimé ne semble pas fonctionner de cette façon[1].

  • when you said revert, what did you mean, 7 years ago, lol
  • but the next time you update it gets the file you didn't want back... :S
  • if you don't want it back, svn commit that file, to put the version you want into the repo
  • This probably does not actually do what the question asker wanted. Using this, the working copy is clean and cannot be committed AS IS, and an "svn update" without a version number specified will retrieve the latest, unwanted version.
  • How can I commit the reverted file then?
  • This isn't quite right because, as CXJ mentions, there isn't a way to commit the updated file. You probably want to do as Mitch Dempsey says (note, however, the --force to force overwriting the file): svn export --force -r 147
  • This is by far the best answer on the page. It leaves the changed file in a state that can be committed.
  • this doesn't seem to work when you are pasting into a new file
  • haha looking back at it, idk what context i was thinking of when i posted. I can't recall. It does seem nonsensical.
  • This is simple and straightforward for when you simply want to undo your changes and get a file back into it's pre-commit state without any version control technicalities.
  • What's up with all the other answers with longer commands? Thanks.
  • You are welcome. I have no idea what is up with other answers.. lol