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?
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).
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…
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 .
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).
find -type d -name .svn|xargs rm -rf
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.
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.
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.
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
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.)
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