简体   繁体   English

如何将Xcode项目转换为工作区并避免git合并冲突

[英]How to convert Xcode project into workspace and avoid git merge conflicts

Currently I am working on a team project with Xcode that is stored in Foo.xcodeproj . 目前,我正在使用存储在Foo.xcodeproj Xcode进行团队项目。 We all work on our own branches and do git pull requests for merging into the common dev branch. 我们都在自己的分支上工作,并进行git pull请求以合并到通用dev分支中。 I am at a point where I want to use CocoaPods and once I do a pod install then the workspace Foo.xcworkspace will be created. 我到了要使用CocoaPods的地步 ,完成pod install后,将创建工作区Foo.xcworkspace The CocoaPod docs say: CocoaPod文档说:

Make sure to always open the Xcode workspace instead of 
the project file when building your project

On my branch I will have a workspace file whereas everyone else will be still working directly with the project file. 在我的分支上,我将有一个工作区文件,而其他所有人仍将直接使用项目文件。 I am trying to be preemptive and avoid difficult git merge conflicts. 我试图抢占先机,并避免困难的git merge冲突。 Will it matter if my teammates are still opening the project file or are we going to have merge conflict hell? 如果我的队友仍在打开项目文件,还是我们将发生合并冲突地狱,那有关系吗?

Being a one team you all should work in one either in Project or Workspace, are you the only one using cocoapods no one else in Team wants to get the functionalities available through Pods . 作为一个团队,你们所有人都应该在Project或Workspace中一起工作,您是唯一使用cocoapods人吗,团队中的其他任何人都不希望通过Pods获得功能。 If you are the only one continuing with PODS be careful while committing the project file in git. 如果您是唯一继续使用PODS的人,请在git中提交项目文件时要小心。

Answer to your question, just commit your Podfile , podfile.lock and .xcworkspace file in git and whenever the other teammate is getting the pull ask him to do a pod install and then open the .xcworkspace file to work as you did initially. 回答您的问题,只需在git中提交您的Podfilepodfile.lock.xcworkspace文件,每当其他队友获得拉动时,请他进行pod install ,然后打开.xcworkspace文件即可正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM