svn – Re-establish history for files renamed by delete/add in Subversion – Education Career Blog

Someone has inadvertently renamed a file in an SVN working copy by deleting the old one and adding the renamed file, instead of using the proper SVN rename command. Changes have continued to be made to the new file, but unfortunately the history is now broken. Unless you know where to look, you wouldn’t even know that this is a problem.

Is there any way for me to re-link the history of the old file and the new file?


How many changes has been performed?

My solution would be:

  1. Delete current file
  2. Copy the latest version N of the file that was deleted with: svn copy -r N proto://path/to/file.ext file.ext
  3. Rename it with proper svn rename
  4. Reapply each diff, that has been done with “new” file (if it is not so important – you also can get only one big diff between “first rev of new file” and “last rev of new file”


There is no straight forward way to do this in subversion. Actually subversion developers have been debating a lot (without a consensus) on this topic. In your case what you need is just to skip the specific revisions which caused the delete and rename. You can look for more on this topic if you search for subversion obliterate. This link has a howto on this topic.

Note: Unless done carefully you might end up in trouble. Also make sure you maintain the UID while doing the dump and load, else developers will have to do a switch to the updated repo.

Leave a Comment