I have a script in which I add all new files before to commit my working copy to my repository with this line:
svn status | grep ^\? | awk '{print $2}' | xargs svn add
I now want to add a line that delete from repository all deleted files in my working copy. In other terms, I cannot specify them one by one, and I need to detect them with svn status and then automatically remove them. However the line doesn't work.
svn status | grep ^\! | awk '{print $2}' | xargs svn --force delete
As you can see I've replaced
"?
" with "!
" and
"add
" with "--force delete
"
Could you tell me why it doesn't work ?
ps. I know it is a risky procedure. I've already discussed all about it. thanks
thanks
Delete Files using git rm. The easiest way to delete a file in your Git repository is to execute the “git rm” command and to specify the file to be deleted. Note that by using the “git rm” command, the file will also be deleted from the filesystem.
Just run the rm command with the -f and -r switch to recursively remove the . git folder and all of the files and folders it contains. This Git repo remove command also allows you to delete the Git repo while allowing all of the other files and folder to remain untouched.
You can now delete an entire directory of files including subdirectories from your web browser: Browse to the directory in the repository and branch that you want to delete. In the top-right corner, click "…", and then Delete directory. Review the list of files.
I just tried this and it works perfectly.
$ svn st | grep '^!' | awk '{print $2}' | xargs svn delete --force D groups.pl D textblock.pl
Do your files have spaces in their names?
WAIT A SECOND!! I see the problem. You have:
svn --force delete
and not:
svn delete --force
The --force
is a parameter of the delete
command and not the svn
command.
I have found another solution, too.
svn status | grep '^\!' | sed 's/! *//' | xargs -I% svn rm %
I have seen it on http://donunix.blogspot.de/2009/02/svn-remove-all-deleted-files.html
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