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?
-
Since this question doesn't apply to WordPress itself but to development and deployment, I'm closing as off-topic and migrating it to Stack Overflow.– EAMannJun 3, 2011 at 15:32
-
possible duplicate of Removing .svn files from all directories– zzzzBovNov 17, 2012 at 3:04
-
possible duplicate of How do you remove Subversion control for a folder?– finnwNov 17, 2012 at 10:09
7 Answers
find -type d -name .svn|xargs rm -rf
-
2
-
3On mac osx you have to change up this command a bit. try this ... find ./ -name ".svn" | xargs rm -Rf Mar 19, 2013 at 16:47
-
1in the newly released svn 1.8, there is only a single .svn directory at the top level.– thekbbJul 1, 2013 at 22:19
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.
-
mod +1: Use
svn export
and create a clean copy for your wordpress site in another directory. If you remove the .svn folders, you can't update or use your workspace anymore. Thus, force to do a newsvn checkout
anyway.– David W.Jun 3, 2011 at 17:11 -
additionally you can export only the last updated files spanning only the commits you need, very useful. Another thing I like to do, in CuteFTP, I set a mask so that CuteFTP will not upload .svn folders, useful when I do quick drag and drop uploads, bypassing export. Jun 18, 2011 at 19:00
-
Note that svn export won't follow any symlinks that may exist in the repo, but will copy the symlink themselves over to the destination (which doesn't work well with relative symlinks..). Jun 8, 2012 at 10:10
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.
-
Thanks for the answers, the FTP exclude seems handy, will check if there is something for FileZilla.– drtanzJun 3, 2011 at 12:42
-
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.)
you just have to use the export-function from SVN and export your folder in itself and it will remove the .svn folder and uncouple it from the version control.
Reference: http://tortoisesvn.net/unversion.html