Xcode 源代码管理显示多个工作副本

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

Xcode Source Control showing multiple Working Copies

xcodeversion-control

提问by HenryRootTwo

Xcode is showing multiple working copies:

Xcode 显示多个工作副本:

Working Copies
myProject - master
myProject_olderRepo
myProject_originalRepo

The second two are greyed out.

后两个是灰色的。

The original code was cloned in Sourcetree from the repo of a previous owner. Not knowing how to move the files into a new repo, I simply copied locally the entire project directory, and started work on them. Then I copied the contents of that reworked project directory into a folder linked to a repo to which others have access. When they clone the repo they get compile errors because modules (the two older repos) are missing.

原始代码是从前任所有者的 repo 中克隆到 Sourcetree 中的。不知道如何将文件移动到新的存储库中,我只是在本地复制了整个项目目录,然后开始处理它们。然后我将重新设计的项目目录的内容复制到一个文件夹中,该文件夹链接到其他人可以访问的存储库。当他们克隆 repo 时,他们会收到编译错误,因为缺少模块(两个旧的 repos)。

I have almost no experience of source control and Bitbucket et al, so I humbly ask forgiveness for anything completely stupid that I am doing.

我几乎没有源代码控制和 Bitbucket 等人的经验,所以我谦虚地请求原谅我所做的任何完全愚蠢的事情。

How do I remove those older working copies from Xcode's source control? Or is there some other way that others can then clone and compile the project without errors?

如何从 Xcode 的源代码管理中删除那些旧的工作副本?或者有没有其他方法可以让其他人克隆和编译项目而不会出错?

回答by HenryRootTwo

Solved this by deleting xccheckout file under

通过删除下的 xccheckout 文件解决了这个问题

ProjectName.xcodeproj > project.xcworkspace > xcshareddata

This had contained references to the previous repos.

这包含对先前存储库的引用。

回答by Piyush

I have removed old repo using following steps.

我已经使用以下步骤删除了旧的 repo。

  • ProjectName.xcodeproj -> Show Package Contents
  • project.xcworkspace -> Show Package Contents
  • xcshareddata
  • Open .xcscmblueprint file using any text editor
  • Remove all unrequited repo from following location DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey
  • Save file and open Xcode again
  • ProjectName.xcodeproj -> 显示包内容
  • project.xcworkspace -> 显示包内容
  • 共享数据
  • 使用任何文本编辑器打开 .xcscmblueprint 文件
  • 从以下位置删除所有单向存储库 DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey
  • 保存文件并再次打开 Xcode

Note : If your project have WorkSpace then Direct click on ProjectName.xcworkspace instead of ProjectName.xcodeproj

注意:如果您的项目有 WorkSpace,则直接单击 ProjectName.xcworkspace 而不是 ProjectName.xcodeproj

回答by Alain Stulz

I am using Cocoapods and have a .xcworkspace along with my .xcodeproj.

我正在使用 Cocoapods 并且有一个 .xcworkspace 和我的 .xcodeproj。

This is what worked for me:

这对我有用:

  1. Remove Cocoapods from the project using pod deintegratein Terminal.
  2. Run pod clean
  3. Run pod installto create it again.
  1. pod deintegrate在终端中使用从项目中删除 Cocoapods 。
  2. pod clean
  3. 运行pod install以再次创建它。

Now if you open the Workspace again, the other Working Copies should no longer exist.

现在,如果您再次打开工作区,其他工作副本应该不再存在。

回答by Brad Howes

If you have Git repositories showing up, then you must have a *.xcscmblueprintfile somewhere in your project. For me, it was in my workspace and not in a project. From terminal window:

如果您显示了 Git 存储库,那么您的项目中必须有一个*.xcscmblueprint文件。对我来说,它是在我的工作区而不是在项目中。从终端窗口:

% find . -name '*.xcscmblueprint' ./TaskMe.xcworkspace/xcshareddata/TaskMe.xcscmblueprint

% find . -name '*.xcscmblueprint' ./TaskMe.xcworkspace/xcshareddata/TaskMe.xcscmblueprint

Edit that file with care to keep just the entry you want. Or perhaps better, just delete the file and add back the repository you want.

小心编辑该文件以仅保留您想要的条目。或者也许更好,只需删除文件并重新添加您想要的存储库。

回答by cgeek

This solution helped me. Go to terminal and paste below code (this will show hidden files)

这个解决方案帮助了我。转到终端并粘贴以下代码(这将显示隐藏文件)

defaults write com.apple.finder AppleShowAllFiles YES.

Now go to your project folder and check if there is any .git files outside your working project folder. enter image description here

现在转到您的项目文件夹并检查您的工作项目文件夹之外是否有任何 .git 文件。 enter image description here

.git file that is located outside project folder do not belong to your working project but other project. ( This is possible if you have made mistake in creating git for other project)

位于项目文件夹外的 .git 文件不属于您的工作项目,而是属于其他项目。(如果您在为其他项目创建 git 时犯了错误,这是可能的)

Either cut paste this .git file and save it some other location or you can delete it (if not so important). After deleting , reopen your project in xcode.

剪切粘贴此 .git 文件并将其保存在其他位置,或者您可以将其删除(如果不是那么重要)。删除后,在 xcode 中重新打开您的项目。

回答by vauxhall

If this issue happens when using CocoaPodstry:

如果在使用CocoaPods时出现此问题,尝试:

  • RemovemyProject.xcworkspace
  • RemovePods/
  • Runpod install
  • 删除myProject.xcworkspace
  • 移除Pods/
  • pod install

回答by virgiltang

Project.xcodeproj -> Show Package Contents

Project.xcodeproj -> 显示包内容

Project.xcworkspace -> Show Package Contents

Project.xcworkspace -> 显示包内容

xcshareddata

共享数据

Open .xcscmblueprint file

打开 .xcscmblueprint 文件

Clean all content

清理所有内容

Save file and open Xcode again

保存文件并再次打开 Xcode

回答by DevB2F

I had two instances of the same project in my ProjectNavigator in XCode. One of them was marked with M and the other one with ?

我在 XCode 的 ProjectNavigator 中有同一个项目的两个实例。其中一个标有 M,另一个标有 ?

All I had to do to get rid of the copy, was delete the project marked with ? by control-clicking on it and selecting delete.

我所要做的就是删除副本,是删除标有 ? 通过控制单击它并选择删除。

回答by Devendra Singh

Follow the following steps:

请按照以下步骤操作:

1.  Open terminal and go to your project directory
2.  Run?pod deintegrate?in Terminal to remove Cocoapods from the project.
3.  Run?pod clean
4.  Run?pod install?to create it again.

Open .xcworkspace, worked for me.

打开 .xcworkspace,对我来说有效。

回答by Jonny

Not sure what happened here, I had one project but two working copies, similar to question. One of the working copies was synced with a repo on GitHub, and I had successfully pushed changes there. All I had to do, in the end, was to delete my local folder completely, then check out (clone?) from the remote repo on github again.

不确定这里发生了什么,我有一个项目,但有两个工作副本,类似于问题。其中一个工作副本与 GitHub 上的一个存储库同步,我已经成功地将更改推送到那里。最后,我所要做的就是完全删除我的本地文件夹,然后再次从 github 上的远程存储库中检出(克隆?)。

(I'm not sure but I got the feeling that Xcode and/or the Xcode project was NOT handling multiple working copies, but that this was done like a top layer in the git structure itself. Maybe it is a feature of git?)

(我不确定,但我觉得 Xcode 和/或 Xcode 项目没有处理多个工作副本,但这就像 git 结构本身的顶层一样。也许这是 git 的一个特性?)