对于 Xcode 项目,是否也可以将 .xcodeproj 文件添加到源代码管理中?

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

For an Xcode project, is it good to add .xcodeproj files to the source control as well?

xcodegitsvnversion-control

提问by Jeremy L

I am using Xcode 4.3.2 and realized that the project files are not added to the git repo, so I added them and committed: (there are 6 files)

我正在使用 Xcode 4.3.2 并意识到项目文件没有添加到 git repo,所以我添加了它们并提交:(有 6 个文件)

# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   new file:   Proj01.xcodeproj/project.xcworkspace/contents.xcworkspacedata
#   new file:   Proj01.xcodeproj/project.xcworkspace/xcuserdata/jeremy.xcuserdatad/UserInterfaceState.xcuserstate
#   new file:   Proj01.xcodeproj/project.xcworkspace/xcuserdata/jeremy.xcuserdatad/WorkspaceSettings.xcsettings
#   new file:   Proj01.xcodeproj/xcuserdata/jeremy.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
#   new file:   Proj01.xcodeproj/xcuserdata/jeremy.xcuserdatad/xcschemes/FlipCard.xcscheme
#   new file:   Proj01.xcodeproj/xcuserdata/jeremy.xcuserdatad/xcschemes/xcschememanagement.plist

but is it actually a good practice to do so? (one time Xcode crashed and the folder .xcodeproj was gone).

但这样做实际上是一个好习惯吗?(有一次 Xcode 崩溃,文件夹 .xcodeproj 不见了)。

采纳答案by moujib

As said your .xcodeproj is very important and should be included in your commit

如前所述,您的 .xcodeproj 非常重要,应该包含在您的提交中

I just want to add this link about using xcode with git which helped me a lot : http://shanesbrain.net/2008/7/9/using-xcode-with-git

我只想添加这个关于在 git 中使用 xcode 的链接,这对我有很大帮助:http: //shanesbrain.net/2008/7/9/using-xcode-with-git

回答by mipadi

It's important to add the project.pbxprojfile, but nothing else in the .xcodeprojbundle needsto be under version control.

添加project.pbxproj文件很重要,但.xcodeproj捆绑包中的任何其他内容都不需要受版本控制。

回答by DrummerB

Well, since all the file references, build settings, target options are saved in the .xcodeproj file, yes, you should include it in your repository. I usually exclude most (if not all) user specific files, such as breakpoints, user interface state etc.

好吧,由于所有文件引用、构建设置、目标选项都保存在 .xcodeproj 文件中,是的,您应该将其包含在您的存储库中。我通常排除大多数(如果不是全部)用户特定文件,例如断点、用户界面状态等。