How to resolve svn conflict caused by deleted file

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 from your local svn copy by running "rm" command.

Now if you check 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 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

Check svn status of 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.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of Xmodulo.com. He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

Leave a comment

Your email address will not be published. Required fields are marked *

Current ye@r *