创建 .gitignore
cd worksapce 到工程根目录下
touch .gitignore 创建忽略文件
vim .gitignore vim编辑文件
在 .gitignore中添加需要忽略的文件
*.xcuserstate
project.xcworkspace
xcuserdata
UserInterfaceState.xcuserstate
project.xcworkspace/
xcuserdata/
UserInterface.xcuserstate
最后删除缓存
git rm --cached 需要删除的文件路径
如:
git rm --cached ProjectFolder.xcodeproj/project.xcworkspace/xcuserdata/myUserName.xcuserdatad/UserInterfaceState.xcuserstate