How do I remove a file from Subversion without deleting it completely?
I'm using SVN (Subversion) to keep versions of the files I'm working on, but now I want to remove a file from Subversion without removing it completely. I can't see how I can do that?
I'm using the tortoise interface for windows.
Status:
Open Dec 07, 2006 - 07:20 AM
Subversion, tortoise, web development, version control
15answers
Answers
Dec 08, 2006 - 07:36 AM
If you delete a file from your working copy, the file will be marked as removed from the repository next time you commit your changes (though only if you specifically mark the file in the Tortoise dialogue window - as removed files are not committed by default). Earlier versions of the file will of course still be available in the repository, if you should later wish to revert to a previous version or browse the content. If you want to keep the file - but not under Subversion - you have to copy it to another location outside your working copy.
Dec 15, 2006 - 08:25 AM
thanks, jgivoni.
It was the last part i was wondering about. Keeping the file, but not under Subversion.
I find it strange that there isn't any other way to do it. having to remove sounds like a hack.
anyway, thanks for the input.
Feb 11, 2007 - 08:59 AM
I think I might not have understood your question completely - in fact there is a way to keep the file at it's current location, but not have it version controlled with SVN.
Just use the "ignore" options in Tortoise SVN.
Feb 13, 2007 - 01:58 AM
i can't see find any "ignore" option when I right click on the file and go into the subversion menu?
Where did you find that?
Feb 13, 2007 - 02:15 AM
Actually, the ignore option is only available if the ressource hasn't been added to the repository yet!
So you may need to do the following:
1) Move the file out of the working copy
2) Commit changes and make sure to mark the file for deleting
3) Copy the file back in
4) Select "Add to ignore list" in Tortoise menu
Feb 13, 2007 - 02:24 AM
yeah, so it only underlines my first problem: moving a file out of subversion control, without deleting/renaming/moving it.
Strange that that is not possible through the menu options.
Feb 13, 2007 - 04:34 AM
Yeah, I see what you mean. It could be nice if it could be done in one go.
But I guess SVN doesn't see it as it's problem.
Aug 01, 2007 - 10:52 PM
There are still problems with this approach. Suppose another user adds inappropriate files to a repository (e.g. a user-specific project preferences file). Then when I update to the latest version, subversion will overwrite my preferences file.
At this point, I want to remove these files from the subversion repository, but not delete them. If I copy them out of the working copy, then do a svn del, and copy them back, the problem is solved from my point of view. But it is not solved from the point-of-view of other users. When they try to update, their preferences file will be deleted. And then they'll be very annoyed!
See the problem?
Aug 01, 2007 - 11:50 PM
Yes, this can be avoided by simply selecting "Add to ignore list" with TortoiseSVN (as described above).
This will put a property on the parent folder telling svn to ignore certain file name patterns within. The file you wish to ignore has to be a new file that is not yet added to the repository, otherwise TortoiseSVN won't show the ignore option.
Aug 02, 2007 - 07:32 AM
Well, yes, the right thing to do is not to add those files to the repository in the first place, preferably (as you suggest) by adding to an ignore list.
But is there any way to do this once a file has already, inappropriately been added to a repository? It ought to be possible to release a file from svn control without actually deleting it.
Aug 02, 2007 - 09:21 AM
It's the same feature dustPuppy was looking for originally (see the beginning of this question).
Unfortunately, I haven't seen this implemented yet, though it could probably be done quite simply - maybe an idea to write to the TortoiseSVN team?
To repeat - the solution for now seems to be:
1. Backup your file
2. Delete it from the repository
3. Copy the file back into position
4. Add it to the ignore list
Jakob
Aug 02, 2007 - 09:26 AM
Yes, but that still has the problem that when other users update, they will lose their copy of of the file I deleted from the repository. Worse still, SVN won't warn them, or provide any mechanism by which they can recover their file. The only thing that they can do is restore the last repository version.
Jan 29, 2010 - 01:25 AM
svn delete --keep-local /path/to/the/file
Apr 03, 2010 - 09:11 AM
A good way to solve this problem (without using the command line) seems top be:
Right mouse button/Tortoise SVN/Export
and then to export to itself (name the same folder as the export-to folder)
Result: all .svn-folders in all subfolders are removed!
Feb 08, 2011 - 07:08 AM
use the following command, it keeps the local copy in the working copy, but removes it from the repository:
svn delete --keep-local filename
Answer this question
Share Your Own Experience & Expertise
We look to ensure that every question is answered by the best people with relevant expertise and experience, the best answers include multiple perspectives. Do you have relevant expertise or experience to contribute your answer to any of these commonly asked questions?
Add New Comment