Chris J Allen
Chris J Allen

Reputation: 19207

'Un-SVN' a working copy

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?

Upvotes: 47

Views: 30441

Answers (14)

Scott Kramer
Scott Kramer

Reputation: 1731

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

Upvotes: 4

radarbob
radarbob

Reputation: 5101

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.

Upvotes: 2

Andy Lester
Andy Lester

Reputation: 93676

If you were using *nix-like tools:

find . -type d -name .svn -print0 | xargs -0 rm -fr

Upvotes: 23

Mike
Mike

Reputation: 21

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.

Upvotes: 2

sakra
sakra

Reputation: 65801

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

Upvotes: 3

rmeador
rmeador

Reputation: 25694

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.

Upvotes: 1

Esteban Brenes
Esteban Brenes

Reputation: 1163

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.

Upvotes: 13

Marko Dumic
Marko Dumic

Reputation: 9888

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.

Upvotes: 4

Surgical Coder
Surgical Coder

Reputation: 1084

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.

Upvotes: 3

Michel
Michel

Reputation: 726

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

Upvotes: 2

Robert Elwell
Robert Elwell

Reputation: 6668

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.

Upvotes: 47

Sam
Sam

Reputation: 29009

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)

Upvotes: 1

Ben Hoffstein
Ben Hoffstein

Reputation: 103345

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.

Upvotes: 4

Gregor
Gregor

Reputation: 1701

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

Upvotes: 32

Related Questions