xcode 版本控制下的 xcodeproj

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

xcodeproj under version control

xcodeversion-control

提问by shreyasva

What are the best practices while including a Xcode project under version control.

在版本控制下包含 Xcode 项目时的最佳实践是什么。

回答by Abizern

This is what is in my Global.gitignorefile which you can see as a giston GitHub, but the Xcode list can be applied to other systems

这是我的全局.gitignore文件中的内容,您可以在 GitHub 上将其视为要点,但 Xcode 列表可以应用于其他系统

# Mac OS X
*.DS_Store

# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/

# Generated files
*.o
*.pyc

#Python modules
MANIFEST
dist/
build/

# Backup files
*~.nib
\#*#
.#*

回答by Jonah

Check in project.pbxproj, ignore the user specific files.

签入project.pbxproj,忽略用户特定文件。

Include shared components and third party libraries as project dependencies using submodules/externals/whatever your VCS supports instead of manually copying static library binaries without any history.

使用子模块/外部文件/VCS 支持的任何内容将共享组件和第三方库包含为项目依赖项,而不是手动复制没有任何历史记录的静态库二进制文件。

You will get merge conflicts in the project.pbxproj, be prepared to deal with this and try to minimize the difficulty of resolving them.

您将在 中遇到合并冲突project.pbxproj,准备好处理这个问题并尽量减少解决它们的难度。

  • Have a consistent structure for where files should be on disk and how that maps to groups in Xcode.
  • Sort the resources included in your build targets and the order of resources within your project's groups. I really need to write a script to do this for me because it is so much easier to identify the cause of a merge conflict when you don't have to diff two random sets of files. It also avoids many merge conflicts as you're less likely to have multiple developers all appending new resources to the bottom of a list.
  • 对于文件应该在磁盘上的位置以及它如何映射到 Xcode 中的组,具有一致的结构。
  • 对构建目标中包含的资源以及项目组中资源的顺序进行排序。我真的需要编写一个脚本来为我执行此操作,因为当您不必区分两组随机文件时,确定合并冲突的原因要容易得多。它还避免了许多合并冲突,因为您不太可能让多个开发人员都将新资源附加到列表的底部。

Check in early and often.

尽早并经常入住。

回答by Winder

In my project I have Project.xcodeproj/project.pbxprojin version control and leave out the User.mode1v3and User.pbxuserfiles.

在我的项目中,我进行Project.xcodeproj/project.pbxproj了版本控制并省略了User.mode1v3User.pbxuser文件。

project.pbxproj seems to hold the metadata for the project, such as where the files are located and what the build settings are.

project.pbxproj 似乎保存了项目的元数据,例如文件所在的位置以及构建设置是什么。

The user files would have things like what files are opened, where the cursor is, etc.

用户文件将包含诸如打开的文件、光标所在的位置等内容。

You can also refer to THISquestion for what files some people have chosen to ignore.

您还可以参考问题了解某些人选择忽略的文件。