在 Xcode 6.3 中分离所有工作副本并重置所有版本历史记录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29797890/
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 07:03:07  来源:igfitidea点击:

detach all working copies and reset all version history in Xcode 6.3

xcodegitsvn

提问by deebee

I have been working on an Xcode project (that is installed via adhoc installation, for internal use at my company) for a few years now and I had enabled source control since day 1. All was working perfectly until when iOS 8 was released, i decided to convert it into iOS 8 while leaving a backup on the project as it is. So, I renamed the original folder to bimpd_old and started modifying the new project. I am a beginner in git, and I didn't know that doing this might corrupt source control. After doing so (and while still working on both projects) my source control won't commit anymore complaing that the project is not under version control.

我从事 Xcode 项目(通过临时安装安装,供我公司内部使用)已经有几年了,从第一天起我就启用了源代码控制。在 iOS 8 发布之前,一切都运行良好,我决定将其转换为 iOS 8,同时保留项目的备份原样。因此,我将原始文件夹重命名为 bimpd_old 并开始修改新项目。我是 git 的初学者,我不知道这样做可能会破坏源代码控制。这样做之后(并且仍然在两个项目上工作)我的源代码控制将不再提交抱怨该项目不受版本控制。

I tried many solutions on the internet that suggest deleting .svn/.git folders, disabling and reenabling source control, run git init, add *, commit.. I also tried deleting the bimPd.xccheckout EDIT: I already tried the solution from: How to disassociate working copy of an Xcode 5 project from SVN server that diedwith no success. Probably that solution works only for Xcode5 while my issue is in Xcode 6.3

我在互联网上尝试了许多建议删除 .svn/.git 文件夹、禁用和重新启用源代码控制、运行 git init、添加 *、提交.. 我也尝试删除 bimPd.xccheckout 编辑:我已经尝试了以下解决方案:如何将 Xcode 5 项目的工作副本与未成功终止的 SVN 服务器解除关联。可能该解决方案仅适用于 Xcode5 而我的问题是在 Xcode 6.3

I just want to lose all version history, detach/delete all working copies, and start new version control starting today.

我只想丢失所有版本历史记录,分离/删除所有工作副本,并从今天开始开始新的版本控制。

How can I achieve that?

我怎样才能做到这一点?

Notes:

笔记:

  • At first, Xcode gave me a warning that svn needs to be updated.. I did it but still it wouldn't commit
  • I don't need online git (just local)
  • I stopped working on the old project.. and I don't need it anymore.
  • After all my tests and trials, it currently shows 3 working copies in my source control (when I enable it) and I only want one working copy (screenshot below)
  • 起初,Xcode 给了我一个警告,svn 需要更新.. 我做到了,但它仍然不会提交
  • 我不需要在线 git(只是本地的)
  • 我停止了旧项目的工作......而且我不再需要它了。
  • 在我所有的测试和试用之后,它目前在我的源代码管理中显示了 3 个工作副本(当我启用它时),我只想要一个工作副本(下面的屏幕截图)

working copies

工作副本

  • At earlier stages, when I was trying to commit, xcode was giving me a warning that it's unable to commit to www.mydomain.com/bimpd (a custom svn that a friend had made on his site a long time ago) but i can't find this reference anywhere.. (because i have deleted all repositories)
  • Now when I try to commit, i get the following error: the working copy "bimpd.xcodeproject" failed to commit files (screenshot below)
  • 在早期阶段,当我尝试提交时,xcode 警告我它无法提交到 www.mydomain.com/bimpd(一个朋友很久以前在他的网站上制作的自定义 svn)但我可以在任何地方都找不到此参考..(因为我已删除所有存储库)
  • 现在,当我尝试提交时,出现以下错误:工作副本“bimpd.xcodeproject”未能提交文件(下面的屏幕截图)

commit error

提交错误

回答by david72

Check out this answer

看看这个答案

Just navigate to "Your Project".xcodeproj > (Right Click & Show Package Contents) > project.xcworkspace > (Right Click & Show Package Contents) > xcSharedData > "Your Project".xccheckout

Right Click on the file and select Open with, and click on "More..". Use your preferred Text Editor to edit the XML inside, or you can always use the trusty TextEdit.

Your old git/svn servers are probably at the bottom, encased in . Just remove em and reload your project in Xcode.

只需导航到“您的项目”.xcodeproj >(右键单击并显示包内容)> project.xcworkspace >(右键单击并显示包内容)> xcSharedData >“您的项目”.xccheckout

右键单击该文件并选择打开方式,然后单击“更多...”。使用您喜欢的文本编辑器来编辑里面的 XML,或者您始终可以使用值得信赖的 TextEdit。

你的旧 git/svn 服务器可能在底部,包裹在 . 只需删除 em 并在 Xcode 中重新加载您的项目。

回答by coco

I believe @david72 has the correct answer. (I didn't find @dandoonian "order of steps is crucial" to be the case for me.)

我相信@david72 有正确的答案。(我没有发现@dandoonian“步骤顺序至关重要”对我来说是这种情况。)

My problem was my project was using an .xcworkspace. So for me, the path to find the file was:

我的问题是我的项目使用的是 .xcworkspace。所以对我来说,找到文件的路径是:

projectname.xcworkspace(show package contents) -> xcshareddata -> projectname.xcscmblueprint

projectname.xcworkspace(显示包内容) -> xcshareddata -> projectname.xcscmblueprint

I edited that file (took out the "working copies" I didn't need any more), re-saved, and restarted xCode. Voila.

我编辑了那个文件(取出了我不再需要的“工作副本”),重新保存并重新启动了 xCode。瞧。

回答by Piyush

Remove all unrequited repo from following location

从以下位置删除所有未偿还的回购

DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey

DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey

You can remove all unrequited working copy using following linked steps. Multiple Working Copy

您可以使用以下链接步骤删除所有单向工作副本。多个工作副本

回答by deebee

Just to summarize what solved the problem using @david72's help (in one of the comments)

只是总结一下使用@david72 的帮助解决了问题的方法(在其中一条评论中)

P.s. The order of steps is crucial!

Ps 步骤顺序很关键!

  1. Disable source control from xcode
  2. Delete git/svn folders
  3. Clean up xccheckout file
  4. Go to xcode projects and delete the project from there
  5. Reinitialize git: git init, add ., commit
  6. Re-enable source control from Xcode
  7. Re-open project
  1. 从 xcode 禁用源代码管理
  2. 删除 git/svn 文件夹
  3. 清理 xccheckout 文件
  4. 转到 xcode 项目并从那里删除项目
  5. 重新初始化git:git init, add ., commit
  6. 从 Xcode 重新启用源代码管理
  7. 重新打开项目

回答by The1Grenade

Many of these solutions mention deleting the .gitfolder - it should be noted that this action will delete any stashesand local branchesyou may have in reserve.

这些解决方案中的许多都提到了删除.git文件夹 - 应该注意的是,此操作将删除您可能保留的任何隐藏本地分支

I learned this the hard way... and this issue with the extra root-repo showing wasn't even resolved for me! Terrible outcome.

我是通过艰难的方式了解到这一点的……而这个额外的 root-repo 显示的问题甚至没有为我解决!可怕的结果。

(Apologies, I currently do not have the 50 reputation to simply comment on an answer!)

(抱歉,我目前没有 50 的声誉来简单地评论一个答案!)

回答by Jacob F. Davis C-CISO

I had to delete the dreaded Derived Data folder after running pod install.

运行 pod install 后,我不得不删除可怕的派生数据文件夹。

I was using cocoa pods. My commit on the Xcode client was a mess despite my gitHub being just fine.

我正在使用可可豆荚。尽管我的 gitHub 很好,但我在 Xcode 客户端上的提交还是一团糟。

  1. pod installin my directory with podfile
  2. Delete contents of ~/Library/Developer/Xcode/DerivedData
  3. Restart computer
  4. Launch Xcode, open workspace
  1. pod install在我的 podfile 目录中
  2. 删除内容 ~/Library/Developer/Xcode/DerivedData
  3. 重启电脑
  4. 启动Xcode,打开工作区

回答by Alex Zavatone

I had this problem where two remotes appeared when I pressed command 2 in Xcode 10.2.1.

当我在 Xcode 10.2.1 中按下命令 2 时,我遇到了两个遥控器出现的问题。

The trick was selecting one of the remotes, then displaying the Inspectors and selecting the Source Control Inspector. It indicated a working copy that was a in a completely different project folder on my disk. This happened with a clone from git in the terminal. The other remote showed the working copy of the expected folder. Somehow, Xcode was finding a reason to find or resolve something to the other folder.

诀窍是选择其中一个遥控器,然后显示检查器并选择源代码控制检查器。它表示一个工作副本位于我磁盘上完全不同的项目文件夹中。这发生在终端中来自 git 的克隆中。另一个遥控器显示了预期文件夹的工作副本。不知何故,Xcode 正在寻找一个原因来查找或解析其他文件夹的某些内容。

After messing around with Xcode preferences, trying multiple clones, simply renaming the folder of the other working copy to something else solved the problem. Xcode no longer magically tried to add that repo and that working copy to a completely separate clone of the project.

在搞乱 Xcode 首选项后,尝试多个克隆,只需将另一个工作副本的文件夹重命名为其他内容即可解决问题。Xcode 不再神奇地尝试将该存储库和该工作副本添加到项目的完全独立的克隆中。

None of the other solutions of looking for DVTSourceControl files, xccheckout, looking in Xcode workspace or project contents, or deleting the Derived Data, lead to the answer. Simply quitting Xcode, locating the other working copy on disk and renaming it and reopening Xcode solved the problem.

寻找 DVTSourceControl 文件、xccheckout、查看 Xcode 工作区或项目内容或删除派生数据的其他解决方案都没有导致答案。只需退出 Xcode,在磁盘上找到另一个工作副本并重命名它并重新打开 Xcode 即可解决问题。

Who knows what was happening.

谁知道发生了什么。