Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove .svn folders

Tags:

svn

I am using SVN while developing a WordPress site. Now I want to upload it to the server and there are loads of SVN files in .svn folders. Are these safe to remove and how do I remove them?

like image 455
urok93 Avatar asked Jun 03 '11 09:06

urok93


People also ask

Can I delete the .svn folder?

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).

How do I delete a .svn file?

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…

How do I delete a .svn file in Windows?

Right click on the project, go to Team->disconnect. It will open a popup where you select the first option: 'Also delete the SVN meta-information from file system. ' This will remove all the SVN folders automatically along with svn property files that you might forget sometimes while removing .

How do I clean up a .svn folder?

According to this answer and SVN change log, svn cleanup has an option to vacuum pristine copies ( /vacuum ). This is done by default starting from 1.8. From version 1.10 up it is not longer done by default, but can be run using the command svn cleanup --vacuum-pristines (see this answer).


6 Answers

find -type d -name .svn|xargs rm -rf
like image 86
Marcin Avatar answered Oct 06 '22 23:10

Marcin


You may also find the svn export command useful. This command exports a copy of your working tree without the .svn folders.

This comes pretty handy if you develop under the Subversion recommended tagging way, you can always export a tag, and then you'll have a better control over what revision is on production.

like image 30
Fernando Briano Avatar answered Oct 06 '22 23:10

Fernando Briano


If you want to delete all sub folders named .svn then create batch file with this content:

for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *.svn') do (
rd /s /q "%%i"
)

save it in a file del_All_Dot_SVN_Folders.cmd . Run it. Your done.

Thanks to http://www.axelscript.com/2008/03/11/delete-all-svn-files-in-windows/

Remember the above code has .svn whereas the code in the link has only *svn so its better to have the .svn to not accidentally have undesired effect.

like image 31
visar_uruqi Avatar answered Oct 07 '22 01:10

visar_uruqi


If you're going to remove these directories, you will probably get troubles with your svn client. As a result, you have to do a new checkout of your repository.

Instead of removing these directories, you could exclude these from uploading with a filter inside your FTP program. I'm using Trasmit 4, which has support for this kind of functionality.

like image 43
Roman Avatar answered Oct 07 '22 01:10

Roman


Perhaps exporting the folder is a better solution in your case. Exporting, excludes the .svn folders. If not, in mac/linux go to your terminal and type these:

cd /your/directory
find . -iname ".svn" -print0 | xargs -0 rm -r
like image 39
Adam Boostani Avatar answered Oct 07 '22 01:10

Adam Boostani


Your SVN checkout directory should always keep the .svn directories; that's how it communicates with SVN.

But any copies of your checked-out files - e.g. for packaging/uploading - can safely remove the .svn directories. They don't need the SVN-checkout data. To remove the .svn directories from these copies, simply delete them. (And see @Fernando's answer regarding svn export.)

like image 40
Chip Bennett Avatar answered Oct 07 '22 01:10

Chip Bennett