How do you remove Subversion control for a folder?

2019-01-03 11:30发布

I have a folder, c:\websites\test, and it contains folders and files that were checked out from a repository that no longer exists. How do I get Subversion to stop tracking that folder and any of the subfolders and files?

I know I could simply delete the .svn folder, but there are a lot of sub-folders in many layers.

标签: svn
27条回答
虎瘦雄心在
2楼-- · 2019-01-03 12:00

None of these answers was satisfactory for my situation. I'm on subversion 1.8 and I had a working copy that only had a single .svn folder at the very first folder, root. However, I wanted to remove some branches from working copy.

No matter what I did, whenever I ran an 'update' it would restore those files and bring them all back. I didn't want to remove them from the repository, just from my computer -- but I needed to keep the rest of the working copy in tact (thus couldn't just remove the .svn folder).

Solution? svn update --set-depth exclude <dir>

This is a client-side "update" that excludes a specific directory. It can be found in the manuals at svnbook.com. In short, it describes this as:

Beginning with Subversion 1.6, you can take a different approach. First, check out the directory in full. Then run svn update --set-depth exclude on the one subdirectory you don't care about.

For TortoiseSVN, you can also do the same thing by right-clicking the folder you don't want, click on Update to revision..., and then set the 'Update Depth' to Exclude, as seen in this screen shot:

enter image description here

查看更多
冷血范
3楼-- · 2019-01-03 12:01

I found that you don't even need to copy to a temporary location. You can do a

svn export --force .

and the .svn files will be removed in situ, leaving the other files as is. Very convenient and less prone to clutter.

查看更多
何必那么认真
4楼-- · 2019-01-03 12:01

svn export works fine, but I think this is:

svn rm --keep-local <folder/file>

It removes it from your local repository.

查看更多
等我变得足够好
5楼-- · 2019-01-03 12:01

On Windows 10, we need to go to Windows Explorer, and then go to View and check the checkbox for View hidden files.

Then navigate to the folder that has the SVN linked on Windows Explorer and delete the .svn folder/file.

查看更多
仙女界的扛把子
6楼-- · 2019-01-03 12:02

Just remove the .svn folder inside the required folder then the control will be automatically removed.

查看更多
虎瘦雄心在
7楼-- · 2019-01-03 12:03

THE BEST AND EASIEST WAY

If you think that you could win with a simple magic command you are failed! SVN is really tricky and always come back somehow with a new error message in Xcode. Sooner or later, promise... so you have to do it smart!

As you know the regular and best practice under Xcode is deleting a file on the project pane on the left. If you missed it and somehow deleted it in Finder you are in trouble. Big trouble! But you could solve it and spare time if you do it well.

First, you need to delete the SVN reference to the file or folder before you could delete it actually

  1. If you could just put back the file/folder from the trash or undo the last step when you deleted it, then...

  2. Go to Terminal - yes, the good old terminal - and go to that location. Best way just type cd then pull the folder/file to the Terminal. You will get something similar

cd /Users/UserName/Documents/Apps_Developing/...

You could check where are you with

ls

command which list your files.

  1. Then you need to delete the svn reference with an SVN command:

    svn delete --keep-local fileName_toDelete

This will delete the file from the SVN repository, BUT you have to delete it manually in Finder.

查看更多
登录 后发表回答