views:

10363

answers:

10

How can I "delete" a file which is already in the SVN repository without deleting it from my file system?

Tortoise or Command Line instructions welcome.

Thank you.

A: 
  1. Copy the file to some other location outside the repository.
  2. SVN Delete the file.
  3. Commit
  4. Copy the files back and make sure to ignore them on future commits.

It would work but I'm hoping for something nicer.

Mr Grieves
As this is obviously not an answer you are looking for, why not edit the question to include it?
phihag
+1  A: 

In Tortoise, use the Repo-browser.

anon
but that will delete the local file on an update, which is not the desired outcome in this case.
crashmstr
+32  A: 
svn delete --keep-local the_file
phihag
I am getting a "svn: invalid option: --keep-local" - Is it because I am on 1.4.6?
barfoon
@barfoon: Yes, --keep-local is only available in svn 1.5.0+. I'm afraid you have to manually copy the file beforehand or check it out using svn cat afterwards.
phihag
+4  A: 

In Tortoise, you can also Shift+Right-click to get a menu that includes "Delete (keep local)".

harpo
+14  A: 

Deleting files and folders

If you want to delete an item from the repository, but keep it locally as an unversioned file/folder, use Extended Context Menu → Delete (keep local). You have to hold the Shift key while right clicking on the item in the explorer list pane (right pane) in order to see this in the extended context menu.

crashmstr
A: 

Delete the file from the remote repository:

svn delete http://svn.yourdomain.com/path/to/file.ext
Phil
but that will delete the local file on an update, which is not the desired outcome in this case.
crashmstr
A: 

Rename your file, commit the changes including the "deleted" file,
don't include the new (renamed) file.
Rename your file back.

Avram
A: 

It's retarded that I need reputation to comment but not to provide an answer, so I'm writing my "comment" to the second best answer from Philhag. It has 10 ups, and is completely incorrect. There is no --keep-local option for svn delete. Check any language definition or the redbook. It doesn't exist (at least in the standard implementation).

If you're using the cmd line, MrGrieves and Avram's response is the correct one. I would give them "ups" but again, Stackoverflow doesn't allow me to with my current rep.

That option was added in svn 1.5 — http://svnbook.red-bean.com/en/1.5/svn.ref.svn.c.delete.html#id531291
Ben Blank
A: 

I'm running svn, version 1.6.2 (r37639) this version does support the --keep-local flag (linux cli)

A: 

Rename your file, commit the changes including the "deleted" file, don't include the new (renamed) file. Rename your file back.

that works, but the icons still indicate they are in the repository. it seems, sometimes i'm lucky using tortoise's clean up command to also clean up the icons. anybody has a different idea?