Gitignore for iOS

提交代码到git仓库的时候,有一些文件是多余的,这个时候需要配置gitignore文件来忽略多余文件,其实就是和.git同级目录下配置.gitignore文件
我的iOS项目的中.gitignore

# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
.DS_Store
build/
DerivedData/
.idea/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.mobileprovision
*.xccheckout
*.xcscmblueprint

## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

# 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/
Pods
Podfile.lock
# 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 repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

对于已经存在的项目配置.gitignore文件,需要执行以下命令来使.gitignore文件生效

git -rm -r --cache .
git add .
git commit -m "Clean up ignored files"
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 关于 .DS_Store 文件 DS_Store 是用来存储这个文件夹的显示属性的,比如文件图标的摆放位置。删除以...
    水止云起阅读 345评论 0 0
  • 人这一生,可能会有后悔的事情,唯独我 只后悔没有早点遇到你。直到现在我依旧抱憾!在敲这篇文字的时候,我们已经认识五...
    甚浅sunshine阅读 449评论 0 0
  • 此文分享一个职场小技巧,作为一个实习生,没活儿干的时候不多,一般都会出现在年底或者项目结束后的过渡期。这个时候,正...
    cee508a698eb阅读 3,975评论 0 5
  • 三、进化 开门的声音把沈欣吓的一哆嗦,看到提着早点的刘潇进门,她放声大哭,三步并作两步扑到了刘潇怀里。 刘潇一脸蒙...
    tanxiaotian阅读 417评论 0 0