This text is a work in progress—highly subject to change—and may not accurately describe any released version of the Apache™ Subversion® software. Bookmarking or otherwise referring others to this page is probably not such a smart idea. Please visit http://www.svnbook.com/ for stable versions of this book.

Name

svn delete (del, remove, rm) — Delete an item from a working copy or the repository.

Synopsis

svn delete PATH...

svn delete URL...

Description

Items specified by PATH are scheduled for deletion upon the next commit. Files (and directories that have not been committed) are immediately removed from the working copy unless the --keep-local option is given. The command will not remove any unversioned or modified items; use the --force option to override this behavior. A directory that contains unversioned or modified items will not be deleted, unless the --force is used.

Items specified by URL are deleted from the repository via an immediate commit. Multiple URLs are committed atomically.

Options

Examples

Using svn to delete a file from your working copy deletes your local copy of the file, but it merely schedules the file to be deleted from the repository. When you commit, the file is deleted in the repository.

$ svn delete myfile
D         myfile

$ svn commit -m "Deleted file 'myfile'."
Deleting       myfile
Transmitting file data .
Committed revision 14.

Deleting a URL, however, is immediate, so you have to supply a log message:

$ svn delete -m "Deleting file 'yourfile'" \
             file:///var/svn/repos/test/yourfile

Committed revision 15.

Here's an example of how to force deletion of a file that has local mods:

$ svn delete over-there 
svn: E195006: Use --force to override this restriction (local modifications m\
ay be lost)
svn: E195006: '/home/sally/project/over-there' has local modifications -- com\
mit or revert them first
$ svn delete --force over-there 
D         over-there
$

Use the --keep-local option to override the default svn delete behavior of also removing the target file that was scheduled for versioned deletion. This is helpful when you realize that you've accidentally committed the addition of a file that you need to keep around in your working copy, but which shouldn't have been added to version control.

$ svn delete --keep-local conf/program.conf
D         conf/program.conf

$ svn commit -m "Remove accidentally-added configuration file."
Deleting       conf/program.conf
Transmitting file data .
Committed revision 21.
$ svn status
?       conf/program.conf
$
[Note] Note

The behavior of the --keep-local option does not propagate to other working copies which contain the items you've scheduled for deletion. If you commit the deletion of those items they will remain in your working copy, but they will be deleted from other working copies which contain them when those working copies are then updated.