最近新项目提交代码的时候总会遇到有这么个文件(UserInterfaceState.xcuserstate)一直在自动更新,ignore也没有效果,后面在网上找了些资料,大部分都是下面这样的这种操作
git rm --cached [YourProjectName].xcworkspace/xcuserdata/[YourUsername].xcuserdatad/UserInterfaceState.xcuserstate
git commit -m "Removed file that shouldn't be tracked"
git push
YourProjectName: 项目名
YourUsername:用户名
结果就是报错
fatal: pathspec 'xxx.xcodeproj/project.xcworkspace/xcuserdata/raymon.xcuserdatad/UserInterfaceState.xcuserstate' did not match any files
这里尝试了下查找所有的UserInterfaceState.xcuserstate文件进行删除
git rm --cache */UserInterfaceState.xcuserstate
git commit -m "delete UserInterfaceState"
git clean -f -d
结果当然是有效的.....
可以用同样方法删除.DS_Store文件
git rm --cache */.DS_Store
git commit -m "delete DS"
git clean -f -d
有需要的可以尝试下,最后我是直接强制删除了,也可以提交到终端,希望有用吧