简体   繁体   English

git-试图合并,但在xcodeproj / project.pbxproj中发生冲突

[英]git - tried to merge, but got a conflict in xcodeproj/project.pbxproj

When I do git status now, I get this as part of the results 现在执行git status时,我将其作为结果的一部分

#   both modified:      BusinessPlan.xcodeproj/project.pbxproj

This is kind of an important file because Apple's xCode uses it to open the whole project. 这是一个重要的文件,因为Apple的xCode使用它来打开整个项目。 I am not even sure it should be in git. 我什至不确定它应该在git中。 Should it? 应该是?

How can I resolve this? 我该如何解决? Should this file not be committed? 该文件不应该提交吗? I think I might have gotten changes from other developers. 我想我可能已经从其他开发人员那里得到了一些改变。 How can I clean it up and what is the way to work with this kind of a file long-term? 我该如何清理文件以及长期使用这种文件的方法是什么?

Thanks! 谢谢!

Yes, I am afraid you have to merge this file. 是的,恐怕您必须合并此文件。 In fact, in the most case, it can be done correctly and automatically. 实际上,在大多数情况下,它可以正确,自动地完成。 You don't need to merge it yourself. 您不需要自己合并。

ps: about strategy of using git for iOS project, there is quite a lot discussion exist. ps:关于将git用于iOS项目的策略,存在很多讨论。 Google something like iOS gitignore , than you can find link1 or link2 , etc ... Google之类的iOS gitignore之类的东西,您可以找到link1link2等。

In order to get Git and Xcode to play together nicely, you need to tell Git to ignore a handful of the extraneous files Xcode uses. 为了使Git和Xcode很好地协同工作,您需要告诉Git忽略Xcode使用的少量无关文件。

Create a file called .gitignore in the root folder of your project, and include this text: 在项目的根文件夹中创建一个名为.gitignore的文件,并包含以下文本:

# files created by Xcode 3 or older
*.pbxuser
*.mode1
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcclassmodel/
# files created by Xcode 4
xcuserdata/
# build products
*.build/
build/
DerivedData/
# Misc
.svn
.DS_Store

This will instruct Git to ignore all of the files that will cause problems. 这将指示Git忽略所有会引起问题的文件。

Taken from Beanstalk page on Setting up Git with XCode 4 . 取自使用XCode 4设置Git的 Beanstalk页面。

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

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