当Git与Xcode一起使用时,我应该在.gitignore中包含哪些文件?
当前回答
GitHub的人们为Xcode项目提供了详尽的。gitignore文件:
斯威夫特:https://github.com/github/gitignore/blob/master/Swift.gitignore
objective - c: https://github.com/github/gitignore/blob/master/Objective-C.gitignore
其他回答
我建议使用joe生成一个.gitignore文件。
对于iOS项目,执行如下命令:
$ Joe g osx,xcode > .gitignore
它会生成。gitignore:
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
build/
DerivedData
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
*.xcuserstate
基于Mercurial的这个指南,我的.gitignore包括:
.DS_Store
*.swp
*~.nib
build/
*.pbxuser
*.perspective
*.perspectivev3
我还选择了包括:
*.mode1v3
*.mode2v3
根据苹果邮件列表,这是“用户特定的项目设置”。
对于Xcode 4:
xcuserdata
大多数答案都来自Xcode 4-5时代。我建议使用现代风格的ignore文件。
# Xcode Project
**/*.xcodeproj/xcuserdata/
**/*.xcworkspace/xcuserdata/
**/.swiftpm/xcode/xcuserdata/
**/*.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
**/*.xcworkspace/xcshareddata/*.xccheckout
**/*.xcworkspace/xcshareddata/*.xcscmblueprint
**/*.playground/**/timeline.xctimeline
.idea/
# Build
Scripts/build/
build/
DerivedData/
*.ipa
# Carthage
Carthage/
# CocoaPods
Pods/
# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/sign&cert
# CSV
*.orig
.svn
# Other
*~
.DS_Store
*.swp
*.save
._*
*.bak
请从https://github.com/BB9z/iOS-Project-Template/blob/master/.gitignore更新
对于Xcode 5,我添加:
####
# Xcode 5 - VCS metadata
#
*.xccheckout
选自Berik的答案
我们确实发现,即使你添加。gitignore和。gittribte *。Pbxproj文件可能被损坏。所以我们有一个简单的计划。
在办公室编码的每个人都简单地丢弃了对这个文件所做的更改。在提交中,我们简单地提到了添加到源代码中的文件。然后推送到服务器。我们的集成管理器会查看提交细节,并将文件添加到资源中。
一旦他更新了远程,每个人都会有一个工作副本。如果少了什么,我们会通知他把它加进去,然后再拉一次。
这对我们来说没有任何问题。