Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove all deleted files from repository?

Tags:

svn

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

like image 946
aneuryzm Avatar asked Jan 05 '11 20:01

aneuryzm


People also ask

How do I remove a deleted file from my git repository?

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.

How do I delete everything from my GitHub repository?

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.

How do I remove all files from a directory in GitHub?

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.


2 Answers

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.

like image 200
David W. Avatar answered Sep 22 '22 06:09

David W.


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

like image 42
naitsirch Avatar answered Sep 24 '22 06:09

naitsirch