René Nyffenegger
René Nyffenegger

Reputation: 40593

How do I delete a file locally in subversion?

I am trying to locally delete a file that is under subversion's version control, yet without affecting the file's status in the repository.

This is the basic sequence I have done to reach the current situation:

svn co https://..../Path/to/project --depth empty

By force of the --depth empty swicht, this creates the empty directory ./Path/to/project although the directory is not empty in the repository.

I cd into the directory:

cd Path/to/project

and get some files from the repository

svn up file.1
svn up file.2
svn up file.3

Later, I decide I don't want to see file.2 any longer locally. How can I achieve this? That is, that the local situation is as though I'd never done a svn up file.2.

Upvotes: 1

Views: 107

Answers (2)

mliebelt
mliebelt

Reputation: 15525

What you try to reach is supported since Subversion 1.6 (I didn't know that either). You have to use the option svn update --set-depth exclude many-dirs/unwanted-dir.

So in your case, the following command should remove the file (only) locally, and will not show it when doing svn st:

svn update --set-depth exclude file.2

See the documentation for sparse checkout in the SVN red book


Having checked it again with a simple example, I have noticed that it seems to work for directories, but not for files. I have only checked it with the combination TortoiseSVN 1.6.x and SVN server 1.6.x, so I cannot say if it works with SVN 1.7.

Upvotes: 1

altern
altern

Reputation: 5949

It's simple. You just need to delete file.2 locally (on filesystem level). If you're on UNIX, run rm file.2 command at your working copy (path where you have checked out to your files).

Upvotes: 0

Related Questions