一睡互、步驟
1. cd 到項(xiàng)目根目錄
2. touch .gitignore
3. 把內(nèi)容粘貼進(jìn)去
4. 提交上傳忽略文件
二、 iOS忽略文件內(nèi)容
# 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/
*/.DS_Store
.DS_Store
## Other
*.moved-aside
*.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
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
*.xcworkspace
*.xcworkspace/
# 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/**/*.png
fastlane/test_output
# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode
iOSInjectionProject/
其他 :設(shè)置Git全局忽略文件
配置全局忽略文件醒颖,我們就不必給每一個(gè)項(xiàng)目添加單獨(dú)的忽略文件
1.進(jìn)入用戶目錄下壳炎,將第一步中配置好的.gitignore文件拷貝到用戶目錄下,將這個(gè)文件改個(gè)名字腰耙,名字隨意铲球,自己好認(rèn)就行
- 執(zhí)行命令
git config --global core.excludesfile ~/.gitignore_global
效果如下圖.gitignore_global就是我自己起的名字:
至此之后check out 下來(lái)的項(xiàng)目都會(huì)自動(dòng)應(yīng)用這個(gè).gitignore_global文件中所忽略的文件。