在 XCode 中删除文件形式的 SVN 存储库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14284078/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 02:29:55  来源:igfitidea点击:

Remove a file form SVN repository in XCode

xcodesvn

提问by MatterGoal

I have erroneously added a file to a project in Xcode and I have pushed it to the server. Now I want to remove it.

我错误地将文件添加到 Xcode 中的项目,并将其推送到服务器。现在我想删除它。

Does removing the file from the local project will results in removing it from the remote repository too at the first commit?

从本地项目中删除文件是否会导致在第一次提交时也将其从远程存储库中删除?

回答by Mark Szymczyk

Removing the file from the Xcode project isn't going to remove the file from the repository. You have to use the Organizer if you want to remove the file from the repository in Xcode.

从 Xcode 项目中删除文件不会从存储库中删除文件。如果要从 Xcode 的存储库中删除文件,则必须使用 Organizer。

Open the Organizer and click the Repositories button at the top of the Organizer. Select the repository's Trunk folder from the repository list on the left side of the Organizer. Select the file you want to delete. Click the Delete button at the bottom of the Organizer to remove the file from the repository.

打开管理器并单击管理器顶部的存储库按钮。从管理器左侧的存储库列表中选择存储库的 Trunk 文件夹。选择要删除的文件。单击管理器底部的删除按钮以从存储库中删除文件。

回答by David W.

Subversion is like one of those Roach Motels: Files check in, but they never check out.

Subversion 就像那些 Roach Motels 之一:文件签入,但他们从不签出

Once you add a file to Subversion, it's there forever. You can remove it from the current revision of the repository (via the svn rmcommand), but you can never remove it completely. Someone will always be able to see it in a log, and someone can access it by checking out the revision of that directory right before you removed the file.

一旦你将一个文件添加到 Subversion,它就会永远存在。您可以将其从存储库的当前修订版中删除(通过svn rm命令),但您永远无法将其完全删除。有人将始终能够在日志中看到它,并且有人可以通过在删除文件之前检查该目录的修订来访问它。

There has been a lot of debate about this feature. Most version control systems have an obliteratecommand of some sort that allows you to remove a version of a file or completely remove the file from the repository. The problem is that Subversion doesn't revision files -- it revisions the entire repository.

关于这个功能有很多争论。大多数版本控制系统都有某种类型的删除命令,允许您删除文件的版本或从存储库中完全删除文件。问题是 Subversion 不修改文件——它修改整个存储库。

I don't know Xcode, so I can't help you with the exact steps. However, there must be a Repository view in Xcode like there is in Eclipse or a series of subcommands that deal with the repository (much like Eclipse's Teamcommands). You should be able to delete the file from there, then commit your change.

我不知道 Xcode,所以我无法帮助您完成确切的步骤。但是,Xcode 中必须有一个 Repository 视图,就像在 Eclipse 中一样,或者有一系列处理存储库的子命令(很像 Eclipse 的Team命令)。您应该能够从那里删除文件,然后提交您的更改。

That will remove the file from the latest version of the code (and future versions). However, it will still be there in the repository, so someone can find it via the history log, and then checkout the version of the repository right before you deleted the file. If this file contains your Swiss bank account number, you're in trouble.

这将从最新版本的代码(和未来版本)中删除该文件。但是,它仍然存在于存储库中,因此有人可以通过历史日志找到它,然后在您删除文件之前检查存储库的版本。如果此文件包含您的瑞士银行帐号,那么您就有麻烦了。



NOTE: There is a way to remove a file completely from Subversion, but you have to shutdown the repository, dump it out, filter out the file, then load the repository dump into a new repository. It is usually not worth the effort.

注意:有一种方法可以从 Subversion 中完全删除文件,但是您必须关闭存储库,将其转储,过滤掉文件,然后将存储库转储加载到新存储库中。通常不值得付出努力。

回答by cowls

You can do it from command line using svn rm filename

您可以从命令行使用 svn rm filename

http://svnbook.red-bean.com/en/1.6/svn.ref.svn.c.delete.html

http://svnbook.red-bean.com/en/1.6/svn.ref.svn.c.delete.html

回答by pnizzle

Deleting a file from Xcode WILL delete it from your remote repo when you commit (tested with svn).

当您提交(使用 svn 测试)时,从 Xcode 中删除文件将从您的远程存储库中删除它。

Using Xcode 4.6.3 I deleted a file from my project. Committed, and it was in turn deleted from my remote repository. When you delete from Xcode, you must select "move to trash" when prompted what to do. If you select "delete reference" then that file will remain in your remote repository, just as it remains part of your projects files but just not referenced in the actual Xcode project.

使用 Xcode 4.6.3 我从我的项目中删除了一个文件。提交,然后它又从我的远程存储库中删除。当您从 Xcode 中删除时,您必须在提示如何操作时选择“移至垃圾箱”。如果您选择“删除引用”,那么该文件将保留在您的远程存储库中,就像它仍然是您的项目文件的一部分,但不会在实际的 Xcode 项目中被引用。

When you commit your files, count the files that have checkmarks on them, and look at the count that Xcode reports in the bottom right corner, Xcode reports one extra file! Thats the deleted file, which means its committing that change.

当你提交你的文件时,数一数上面有复选标记的文件,并查看右下角 Xcode 报告的计数,Xcode 报告了一个额外的文件!那就是已删除的文件,这意味着它正在提交该更改。

Once again, before committing, go to terminal and 'cd' to the directory where you had the file that you deleted. Enter this:

再一次,在提交之前,转到终端并 'cd' 到您删除的文件所在的目录。输入这个:

svn info ./yourFilesName.txt

You will see a result that says:

你会看到一个结果,上面写着:

Schedule: delete

which means that when you do a commit, the file will be deleted from your remote repo.

这意味着当您提交时,该文件将从您的远程存储库中删除。

回答by fangzl

When you delete from Xcode, you must select "move to trash",and then commit the ".xcodeproj" file

当你从 Xcode 中删除时,你必须选择“移动到垃圾箱”,然后提交“.xcodeproj”文件