I have a file that had been under revision control in SVN (I use tortoiseSVN). This file has become obsolete, thus I no longer want it to be in a working copy of my repo. However, it would probably be good to retain the history of that file.
I essentially want to 'delete' this file such that it is no longer tracked or 'versioned'. I have the option to either 'delete' this file, or 'unversion' this file.
What is the difference between 'delete' and 'unversion'. What the use cases for each command?
svn delete (del, remove, rm) — Delete an item from a working copy or the repository.
To remove a file from a Subversion repository, change to the directory with its working copy and run the following command: svn delete file… Similarly, to remove a directory and all files that are in it, type: svn delete directory…
There is only one . svn folder, located in the base of the working copy. If you are using 1.7, then just deleting the . svn folder and its contents is an easy solution (regardless of using TortoiseSVN or command line tools).
Removing a file from svn, does not delete its revision history.
Apparently deleting the history is possible [SO]: Delete file with all history from svn repository.
To make things easier let's consider the following analogy.
From svn's PoV, just like:
Same way:
Let's say that we have an svn file:
The situation is as follows:
Same thing would happen if removing a file (from its parent folder perspective).
Now, back to your question: on my TortoiseSVN (v1.9.5):
svn delete --keep-local
After performing one of the actions on a file, that file will no longer be tracked by svn, but as opposed to Delete (where the file is also removed from the Working Copy/disk), Unversion will leave it on the disk just like the user would have manually copied it there (a subsequent svn st
will "see" the file as not under version control: the first column will be a question mark (?) as described on [SVNBook]: svn status
).
[TortoiseSVN]: Deleting, Moving and Renaming contains very little official info.
Personally, I see no use of keeping the local file except when fixing an error, e.g. removing previously committed items that don't belong in the repository (user specific) like:
Quote from [SVNBook]: svn delete
:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With