git管理的时候我们并不需要把所有都推送到github上,比如切换的时候我就遇到显示错误
Your local changes to the following files would be overwritten by checkout,我的原因就是
project.xcworkspace/xcuserdata/username.xcuserdatad/userinterfacestate.xcuserstate,缓存文件路径,也被我推送的git上,切换分支的时候出发了缓存,git显示本地有更改,实际分支里面并没有添加新内容,这时我们需要对git配置文件.gitignore做过滤配置,过滤掉我们不需要上传的文件
1、进入到工程目录下,选择工程,shift+command+. 显示隐藏文件.gitignore文件,打开添加下面配置,直接复制粘贴就行,(如果没有.gitignore执行 touch .gitignore 创建,open .gitignore打开 )
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData/
## Various settings
*.xcuserstate
*.DS_Store
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
## Obj-C/S