The simple answer is that you svn export
the file instead of checking it out.
But that might not be what you want. You might want to work on the file and check it back in, without having to download GB of junk you don't need.
If you have Subversion 1.5+, then do a sparse checkout:
svn checkout <url_of_big_dir> <target> --depth empty
cd <target>
svn up <file_you_want>
For an older version of SVN, you might benefit from the following:
- Checkout the directory using a revision back in the distant past, when it was less full of junk you don't need.
- Update the file you want, to create a mixed revision. This works even if the file didn't exist in the revision you checked out.
- Profit!
An alternative (for instance if the directory has too much junk right from the revision in which it was created) is to do a URL->URL copy of the file you want into a new place in the repository (effectively this is a working branch of the file). Check out that directory and do your modifications.
I'm not sure whether you can then merge your modified copy back entirely in the repository without a working copy of the target - I've never needed to. If so then do that.
If not then unfortunately you may have to find someone else who does have the whole directory checked out and get them to do it. Or maybe by the time you've made your modifications, the rest of it will have finished downloading...
The problem with doing an svn merge as suggested by Sean Bright is that is reintroduces other changes made in the same revision as the deletion. An svn copy is a more targeted operation that will only affect the deleted files.
Using Tortoise SVN you can resurrect a file that has been deleted from your working copy directory and from later SVN revisions, via a svn copy as follows:
- Browse to the working copy folder that previously contained the file.
- Right click on the folder in Explorer, go to TortoiseSVN -> Show log.
- Right click on the revision number just prior to the revision that deleted the file and select "Browse repository".
- Right click on the deleted file and select "Copy to working copy..." and save.
The deleted file will now be in the working copy folder. To re-add it back to SVN, right click on the restored file and select SVN Commit.
NB: This method will preserve the previous history of the restored file, however to see the prior history in the TortoiseSVN log you need to make sure "Stop on copy/rename" is unchecked in the Log messages dialog.
Best Answer
TortoiseSVN does delete the file locally if you choose the Tortoise Delete command. To prevent this, you can run
svn delete filename --keep-local
at the command line.Or, as Oskar comments below, you can Shift-right-click on the file in your working copy and select Delete (keep local).
This will queue up the deletion to happen on your next commit, along with any other changes you may make.