Since I could not find the answer of the above question anywhere in the web, I come with the solution myself. It's a manual process but I couldn't find any other standard solution. So here it is:
Suppose you want to delete the file test.txt from directory work. Now if you delete test.txt forcefully by
rm -rf test.txt
command then on the next svn up on the work dir (or any of its parent-directories), the file will be restored. So the trick is to delete it from .svn/entries file, as well. Thus the complete sequence of commands for deleting test.txt only from working copy is:
cd work
rm -rf test.txt
svn st #it shows ! sign beside test.txt which means that
#in the next **svn up** it will be restored
chmod u+w .svn/entries
vi .svn/entries
#delete the lines associated with test.txt
#you need to delete the following 3 lines from .svn/entries
#test.txt
#file
#^L
svn st #it doesn't report test.txt anymore
If you have a working copy which you no longer need, how do you get rid of it cleanly? Easy - just delete it in Windows Explorer! Working copies are private local entities, and they are self-contained. Deleting a working copy in Windows Explorer does not affect the data in the repository at all.
Using the git rm –cached Command We've mentioned that git rm FILE will remove files from the index and local working tree by default. However, the git rm command provides the –cached option to allow us only to remove files from the repository's index and keep the local file untouched.
The git rm command can be used to remove individual files or a collection of files. The primary function of git rm is to remove tracked files from the Git index. Additionally, git rm can be used to remove files from both the staging index and the working directory.
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…
lallafa reports a good method, based on something called sparse directories:
svn update --set-depth exclude <folder-to-delete>
not good if:
svn 1.6
this method tooks 1 hours, but on svn 1.7
it tooks more than 50 hours. This was in 2011.added from source:
if you later want to use that directory again, you can do
svn update --set-depth=infinity <folder-to-delete>
I wish I knew how can I list directories already "excluded" this way, because st
won't show them. :D
another method from same source by someone called 'Mike5' (or jed/jeds) that works on directories:
for every directory you want to avoid updating, do
svn switch --ignore-ancestry http://dummy/exists/but/empty_folder some_folder
some_folder
with the folder you want to ignore.http://dummy/exists/but/empty_folder
with an existing path in your repository which is an empty directory, will never be updated nor deleted - supposedly created and dedicated for this purpose.By this, you will achieve:
You will not achieve:
--depth
, first, do this, and then continue the checkout (not tested).It is also a good idea to use svn propset svn:ignore "*" empty_folder
on the dedicated empty directory, so noone can commit anything to it.
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