31

Possible Duplicate:
How do you remove Subversion control for a folder?

If I want to take a folder that was under Subversion and remove all links to Subversion, do I just delete the .svn folders and that's it? What else do I have to consider?

Community
  • 1
  • 1
PositiveGuy
  • 46,620
  • 110
  • 305
  • 471
  • 3
    **@rm** (and everyone else that say *Export*): There is a difference: "Export" will create a copy that is not linked to subversion, but the SVN working copy will still remain linked... Removing all the `.svn` folders will remove references directly on the SVN working copy. – awe Oct 14 '09 at 11:37

11 Answers11

28

No, you just have to search for all .svn folders and delete them. Alternatively, doing a svn export allows you to get the folder without the svn folders.

Valentin Rocher
  • 11,667
  • 45
  • 59
  • 1
    Only tortoiseSVN will keep your local modifications. Standard SVN export will give you the version from your repository. So you will lose all your local modifications. – Peter Parker Jul 31 '09 at 18:36
  • I am using Tortoise. I want version history, everything removed as if my folder was never hooked/linked to SVN in the first place – PositiveGuy Jul 31 '09 at 18:46
  • 1
    It is good idea to add shell command "Delete from SVN" as described in this blog post http://bit.ly/CDlG. Of course only if you are using windows. – zidane Jun 17 '10 at 08:08
  • check this link contain script to remove .svn flder http://cocoabugs.blogspot.com/2010/09/script-to-remove-hidden-svn-folder.html –  Sep 20 '10 at 11:03
  • 1
    Note: It used to be that there was a `.svn` folder in every folder of the working copy. As of Subversion v1.7 there is only one `.svn` and it is at the root folder of the working copy. Removing the `.svn` folder will make it so the folder is no longer an SVN working copy. – Steven T. Snyder Dec 07 '11 at 00:15
  • FOR /F "tokens=*" %G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q "%G" – Jijo Thomas Feb 05 '15 at 04:14
13

Found the following windows command-line here:

FOR /F "tokens=*" %G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q "%G"

It works for me. (If you want to use this in a batch file, put "%%G" instead of "%G")

user153605
  • 166
  • 4
  • Works perfectly... :) Disconnected from svn for all files and folders under the directory which you execute this command. – Jijo Thomas Feb 05 '15 at 04:10
10

On unix systems over the shell:

find . -type d -name .svn -exec rm -rf {} \; 

On Windows:

  • Execute a search on the folder for ".svn", select all and delete them
Juri
  • 32,424
  • 20
  • 102
  • 136
5

The command svn export does this.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Steve
  • 11,831
  • 14
  • 51
  • 63
5

When using TortoiseSVN, right-mouse drag a folder that is under version control to a destination, and select "SVN Export all items here" from the context menu.

This will create a folder with your working folder, without the .svn files.

Zurb
  • 738
  • 1
  • 5
  • 18
4

Normally yes, removing .svn folders is enough, but define "remove any link to subversion at all". Because there are such features as keyword substitution inside the versioned files.

Laurynas Biveinis
  • 10,547
  • 4
  • 53
  • 66
  • Good point. Also, removing just the .svn (or _svn) directories only tells your Subversion CLIENT (i.e. TortoiseSVN) not to track these files. They of course still exist on the Subversion server. – tyriker Jul 31 '09 at 18:35
  • I am cleaning out my folder that contains my .NET solution and project to have no ties to SVN any longer whatsoever. – PositiveGuy Jul 31 '09 at 18:45
  • what do you mean by versioned files. Once I delete all .svn folders isn't there no more links to SVN? – PositiveGuy Jul 31 '09 at 18:49
  • It is possible to have comments in a file such as "$Revision: 123$" "$Author: Somebody$" whose text is automatically inserted by SVN server and which one could call "a link to SVN" – Laurynas Biveinis Jul 31 '09 at 18:53
  • I just wanted to know if there are any files physically here that I need to delete other than the .svn folder. Are there any other svn related files that live outside an .svn folder period that svn creates? – PositiveGuy Jul 31 '09 at 18:56
  • Ah, OK. Nope, then you delete .svn folders and that's it. – Laurynas Biveinis Jul 31 '09 at 19:02
  • Yes. That's the beauty of SVN: everything related to SVN is defined in each folders own .svn folder. That is also the reason that nothing can be defined to be valid recursively. For example, you cannot define an ignore filter that also applies for all sub folders automatically, which is something I would like to have. The only alternative is to set it in the global options where you can define ignore filter that applies everywhere. – awe Oct 14 '09 at 11:29
3

Yes. Just delete .svn folder and your folder will no longer be under the control of subversion.

The .svn folder is the pristine copy of your repository when you did the checkout. So, it acts as the link between your server and your working copy. Once you delete it, you lose this "link".

Edit:

If you have any subfolder in your project, you will have a .svn folder in each of them. So, if you want to remove the link to subversion, you need to delete these .svn subfolders.

Francis B.
  • 7,018
  • 2
  • 32
  • 54
  • did that. Looks alright except my Resharper Folders still have a ? on them because I never checked them into SVN. But why would they have a ? in them if I deleted all .svn folders...something else is tying my main folder here to SVN still that's telling me that these Resharper folders are not in version control. Why is that? – PositiveGuy Jul 31 '09 at 18:29
  • I dont have resharper so I can't tell you why you have this issue. But I can tell you that once I delete .svn folder, VisualSVN in Visual Studio does not display status icon anymore. – Francis B. Jul 31 '09 at 18:32
  • Yea, I don't have any status icons except that ? which is a Subversion icon because I never checked in those Resharper folders. After deleting all .svn folders I don't get why I am even getting the ? overlay still on those Resharper folders – PositiveGuy Jul 31 '09 at 18:48
  • @coffeeaddict: You may be running into TortoiseSVN cache issues if you are still seeing icons. Rebooting or killing the TSVNCache process should clear it up. – Travis Beale Jul 31 '09 at 19:21
2

Nope, deleting the .svn directories will remove any "connection" to the repository.

mipadi
  • 398,885
  • 90
  • 523
  • 479
  • 1
    Okay, I don't usually complain about downvotes, but why the downvote to this answer? It isn't _wrong_ (or if it is, the downvoter should specify _why_ it's wrong). – mipadi Jul 31 '09 at 18:35
2

You can manually delete all .svn folders.

Alternatively, you can use svn export to export a clean directory tree. Keep in mind though that it will not export files that are not under version control.

The advantage of using svn export is that you can get a pristine copy and keep your original repository in a single command.

Karl Voigtland
  • 7,637
  • 34
  • 29
1

Yes.

Though an easier way is probably to just export that folder.

Assaf Lavie
  • 73,079
  • 34
  • 148
  • 203
1

I like to use deletesvn.reg. It adds a "Delete SVN Folders" to your context-menu in Explorer. Selecting it recursively deletes .svn folders, thus disconnecting your folders from SVN. The problem I've had with SVN Export, as others mentioned, is that it only exports files that are in the repo, ignoring all those hidden files you might need.

DavGarcia
  • 18,540
  • 14
  • 58
  • 96