47

I have a folder that is my working copy. How do I remove all SVN functionality from this folder? There is a reason for me doing this, somehow my master folder that contains all my working copies of sites, has somehow been turned into a working copy itself, so I have a working copy within itself as such.

So, is there an easy way of removing version control from a folder?

14 Answers 14

47

svn export is the command you're looking for. You can export a controlled set of files to a non-controlled location and use that.

0
32

Just remove all ".svn" folders in it. That's it.

2
  • 2
    Elaborating on this. If you try to add a directory to SVN that already has .svn hidden files in it, then svn will refuse to add it. Remove the .svn files and try to svn add it again. If that doesn't work. Delete the directory and do an svn update yourdirectory, then an svn remove yourdirectory. svn often gets confused and panics, and sometimes the only solution is to blow everything away and rebuild everything. Oct 19, 2012 at 0:28
  • roman m is right... Export the project is much easier because there are loooots of .svn folders! Jul 12, 2013 at 7:03
23

If you were using *nix-like tools:

find . -type d -name .svn -print0 | xargs -0 rm -fr
2
  • 10
    Please use find . -type d -name .svn -print0 | xargs -0 rm -fr instead to avoid all hell breaking loose when filenames contain spaces. Sep 22, 2009 at 1:57
  • Thanks; this was just what (I needed. I was using svn to manage a website, but Wordpress auto-updates really wreaked havoc on the w.c. and it wasn't worth digging out from that.) Oct 7, 2012 at 23:47
13

If you're using TortoiseSVN you can just right click within the root folder of your working copy and click Export... That will work even if you have uncommited changes.

Likewise, you can just do an Export from your repository, and it won't create any of the .svn folders.

Another straightforward approach is to just delete all .svn folders as previously mentioned.

4

You can either manually delete all of the .svn folders (make sure to do this for every subfolder as well) or use a simple utility like Jon Gallaway's shell command.

0
4

Windows client "TortoiseSVN" has "Export" feature. Export creates a copy elsewhere in a different folder without all those ".svn" folders in them. You can export either from repository or from local copy with option to include unversioned files.

4

how about this:

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

to recursively remove all the .svn folders--

(if the export function isn't an option for you--, can't access repository etc...)

2
  • 2
    upmod for gratuitous use of DOS :-)
    – endian
    Oct 8, 2008 at 14:58
  • Careful -- that will remove any directory whose name ends in "svn". Sep 22, 2009 at 1:54
3

TortoiseSVN has the ability to Export files without its subversion bindings - right click on a repository (or a directory within a repos), then TortoiseSVN, then Export. Another way to do it is to remove all the .svn directories in all the folders.

3

Here is a Windows batch script that will delete all .svn folders from a Subversion working copy directory:

@echo off
rem cleanup .svn subdirs

setlocal enabledelayedexpansion

rem change to directory that this batch script resides in

if "%~1"=="" (
    echo Usage: svncleanup svn_working_copy_dir
    exit /b 1
)

echo cleaning up .svn subdirs in "%~1" ...

for /R "%~1" %%I in (.svn) do rmdir /Q /S "%%I" > NUL 2>&1
0
2

With TortoiseSVN, you can do a right-clic drag & drop your folder and then choose a "SVN Export All to here" command.

2

I just use Windows Explorer to search for ".svn" (starting at the top of my working copy) and then I select all the folders it finds and delete them.

2

Export in Place with Tortoise

When I read all the above suggestions I cringed because my source files is 3GB, with many.svn folders.

Select Export from the R-click context menu and when the "where to put the copy" dialog pops up, select that same folder itself. OK. Viola all the source control cruft is (recursively) gone, instantly.

1

can't you just delete the .svn subfolder?

As far as I know SVN stores everything about its connection to the repository in this subfolder (at least in windows)

1

As others have said, deleting the .svn folder will remove SVN functionality from that folder. If you do it recursively, you will "un-SVN" your entire WC, which is essentially what the export command does. I'm not sure if it's a feature of Tortoise, the CLI SVN binary, or both, but I recall that one of them allows you to do an in-place export which literally just removes the .svn folders from a WC. A normal export creates a copy of your WC at a new location that is unversioned.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.