1、新建
1.1 此文件的位置跟.git在同一路径
touch .gitignore
1.2 编辑忽略文件
vim .gitignore
//# 粘贴以下内容
*.xcuserstate
project.xcworkspace
xcuserdata
UserInterfaceState.xcuserstate
project.xcworkspace/
xcuserdata/
UserInterface.xcuserstate
//# 保存退出
1.3 添加到缓冲区
git add .gitignore
1.4 提交
git commit -m "add .gitignore file"
1.5 推送
git push
2、使用忽略文件
2.1 删除缓存文件
git rm --cached
工程名称.xcodeproj/project.xcworkspace/xcuserdata/用户名称.xcuserdatad/UserInterfaceState.xcuserstate
2.2 提交
git commit -m 'remove some no woring file'
2.3 推送
git push