'Un-SVN' a working copy

空扰寡人 提交于 2019-11-28 16:58:15

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

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.

If you were using *nix-like tools:

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

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.

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.

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.

Scott Kramer

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

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.

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

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

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.

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.

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)

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!