当Git与Xcode一起使用时,我应该在.gitignore中包含哪些文件?
当前回答
添加一个.gitignore文件
Mac OS x+xcode+swift
这是我如何将.gitignore文件添加到我的Swift项目:
在Xcode中选择你的项目,右键点击→新建组→命名为Git 选择Git文件夹,右键单击→添加新文件 在iOS选项卡中→选择其他→空文件
在这里输入文件名"。gitignore"
确认文件名称和类型
下面是结果结构:
打开该文件并跳过下面的代码
# file
#########################################################################
# #
# Title - .gitignore file #
# For - Mac OS X, Xcode 7 and Swift Source projects #
# Updated by - Ramdhan Choudhary #
# Updated on - 13 - November - 2015 #
# #
#########################################################################
########### Xcode ###########
# Xcode temporary files that should never be committed
## Build generated
build/
DerivedData
# NB: NIB/XIB files still exist even on Storyboard projects, so we want this
*~.nib
*.swp
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
## Other
*.xccheckout
*.moved-aside
*.xcuserstate
*.xcscmblueprint
*.xcscheme
########### Mac OS X ###########
# Mac OS X temporary files that should never be committed
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
########## Objective-C/Swift specific ##########
*.hmap
*.ipa
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Build
# fastlane
#
# It is recommended to not store the screenshots in the Git repository. Instead, use fastlane to re-generate the
fastlane/report.xml
fastlane/screenshots
嗯,多亏了亚当。他的回答帮助了我很多,但我仍然需要添加更多的条目,因为我想要一个.gitignore文件:
Mac OS x+xcode+swift
参考资料:this和this
其他回答
对于Xcode 5,我添加:
####
# Xcode 5 - VCS metadata
#
*.xccheckout
选自Berik的答案
对于Xcode 4,我还添加了:
YourProjectName.xcodeproj/xcuserdata/*
YourProjectName.xcodeproj/project.xcworkspace/xcuserdata/*
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
关于“build”目录排除-
如果您将构建文件放在与源文件不同的目录中,就像我所做的那样,您不必担心树中的文件夹。
这也使得共享代码变得更加简单,防止臃肿的备份,甚至当你依赖于其他Xcode项目时(同时要求构建彼此位于相同的目录中)。
你可以从Github gist https://gist.github.com/708713获取最新的拷贝
我当前的。gitignore文件是
# 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
推荐文章
- 当git说它正在“解析delta”时,它实际上在做什么?
- Git命令将一个文件夹移动到另一个文件夹
- iOS如何设置应用程序图标和启动图像
- 在单个文件中重新启动/撤消冲突解决方案
- Visual Studio代码如何解决合并冲突与git?
- 无法推送到远程分支,无法解析到分支
- 模拟器慢动作动画现在打开了吗?
- Git:如何将数据库重置为特定的提交?
- 如何在合并期间使用Git和命令行保存本地文件或远程文件?
- 能够用一个命令推到所有git遥控器?
- 重新基于Git合并提交
- 忽略已经签入目录的内容?
- 如何完全删除TFS绑定
- 哪些Eclipse文件属于版本控制?
- 如何从windows cmd保存git提交消息?