当Git与Xcode一起使用时,我应该在.gitignore中包含哪些文件?
当前回答
你应该结账给gitignore。用于Objective-C和Swift。
下面是我正在使用的.gitignore文件:
# Xcode
.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
*.xccheckout
*.xcworkspace
!default.xcworkspace
#CocoaPods
Pods
其他回答
我建议使用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
添加一个.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项目>的标准。gitignore文件的结构
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
!default.xcworkspace
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
以下是GitHub默认用于新Xcode存储库的.gitignore:
https://github.com/github/gitignore/blob/master/Objective-C.gitignore
它可能在任何给定的时间都是合理正确的。
gitignore。io:为你的项目创建有用的gitignore文件
Example: Preview | Edit Programming Languages: Objective-C Swift Build Automation Tool: SwiftPackageManager Carthage IDEs: Xcode Operating Systems: macOS Steps to use in Terminal (Refer to the YouTube Video) Create Git global config alias (One time only) git config --global alias.ignore '!gi() { curl -L -s https://www.gitignore.io/api/$@ ;}; gi' Enter the project directory cd <the project directory> Generate .gitignore file git ignore Objective-C,Swift,SwiftPackageManager,Carthage,Xcode,macOS >.gitignore Add and commit .gitignore file git add .gitignore git commit -m "Add .gitignore file"
推荐文章
- 如何在交互式Python中查看整个命令历史?
- 如何从远程Git存储库中提取并覆盖本地存储库中的更改?
- Github:导入上游分支到fork
- Git单次修订的日志
- Git在不改变提交时间戳的情况下进行改基
- 你常用的Xcode快捷键有哪些?
- VS 2017 Git本地提交数据库。每次提交时锁定错误
- 如何在过去的一些任意提交之间注入一个提交?
- 确保您的项目构建设置正在生成一个dSYM文件。对于所有配置,DEBUG_INFORMATION_FORMAT都应该设置为dwarf-with-dsym
- 在OSX中永久设置PATH环境变量
- 从GitHub克隆项目后拉git子模块
- 如何停止mysqld
- GitHub上的分叉和克隆有什么区别?
- 递归地按模式添加文件
- 如何改变时间和时区在iPhone模拟器?