1.打开终端,切换到项目所在的工程目录下,新建.gitignore文件
touch .gitignore
2.打开.gitignore文件
open .gitignore
3.把下git需要忽略的文件代码拷贝到.gitignore中去
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
# Mac OS X Finder and whatnot
.DS_Store
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
## Other
*.moved-aside
*.xcuserstate
*.xccheckout
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
#CocoaPods
Pods/
最后面的
CocoaPods
Pods/是我们指定忽略pod文件。