[Git] gitignore for iOS

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

## Build generated
build/
DerivedData/

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

## Other
*.moved-aside
*.xcuserstate

## 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/

# 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://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/screenshots

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

iOSInjectionProject/

### Objective-C Patch ###
*.xcscmblueprint

# Mac OS directory description file
.DS_Store

# Reveal
Reveal.framework/*

关于 .DS_Store 文件

DS_Store 是用来存储这个文件夹的显示属性的,比如文件图标的摆放位置。删除以后的副作用就是这些信息的失去。如果对这些文件进行版本控制追踪的话,每一个人的操作系统都不同,这个文件的信息都是变化的,所以每次都会发生修改,而且这些文件本身也没有追踪的必要。

删除所有的 .DS_Store 文件

sudo find / -name ".DS_Store" -depth -exec rm {} \;

禁止 .DS_store 生成,重启系统生效

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE

恢复 .DS_store 生成

defaults delete com.apple.desktopservices DSDontWriteNetworkStores

可以通过配置,全局忽略 .DS_Store 文件

1.创建 ~/.gitignore_global 文件

# .gitignore_global
.DS_Store

2.git config --global core.excludesfile '~/.gitignore_global'

你可能感兴趣的:([Git] gitignore for iOS)