How to resolve SVN conflict caused by deleted file

Last updated on June 9, 2020 by Dan Nanni

Here is the situation. Someone has removed a file (e.g., junk.txt) from SVN repository by running "svn rm" and committing it. After that, you, instead of doing "svn update" first, removed the same file junk.txt from your local SVN copy with rm command.

Now if you run "svn status", you will get the following SVN conflict message:

$ svn status
!     C junk.txt
      >   local delete, incoming delete upon update

In this case, it is SVN removal and local removal that are in conflict. In order to resolve this SVN conflict caused by locally deleted file, proceed as follows.

First, re-create the deleted file. It doesn't have to be the same original file. Any random file with the same filename (junk.txt) is sufficient. After all we will remove it anyway.

$ touch junk.txt

Revert this file to the state expected by SVN.

$ svn revert junk.txt

Run "svn status" against the file. The file should appear as a unversioned file, which means that it's now safe to remove it.

$ svn status
?       junk.txt

Finally go ahead and remove it.

$ rm junk.txt

Now you should not be seeing any SVN conflict.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean