cd 你項(xiàng)目目錄
創(chuàng)建gitignore
touch .gitignore
進(jìn)入你iOS項(xiàng)目目錄猎塞,直接修改并保存.gitignore
修改內(nèi)容如下:
# Xcode
.DS_Store
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
## Other
*.moved-aside
*.xccheckout
*.xcworkspace
!default.xcworkspace
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
# CocoaPods
Pods
!Podfile
!Podfile.lock
# Carthage
Carthage/Build
# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
# Code Injection
iOSInjectionProject/
OK,以上完成捣郊,最后一步很關(guān)鍵了非剃,否則.gitignore不能生效的。
如果是項(xiàng)目做到一半才開始加入.gitignore,則需要在commit所有已經(jīng)修改文件后宙暇,執(zhí)行以下命令保證.gitignore開始生效输枯。
git rm -r --cached .
git add .
git commit -m 'update .gitignore'