美文网首页iOS 开发使用WKWebView和H5交互iOS Developer
【iOS 开发】Git 中无法忽略 .xcuserstate 的

【iOS 开发】Git 中无法忽略 .xcuserstate 的

作者: 爱吃鸭梨的猫 | 来源:发表于2017-08-15 11:23 被阅读222次
Git

在平时的 iOS 开发中使用 Git 时会遇到这样的问题,明明在 .gitignore 文件中添加了 .xcuserstate 忽略,之后每次 push 时文件改动中还是会出现 UserInterfaceState.xcuserstate 文件,下面是解决方法。


  • 打开终端,cd 到你的项目文件夹下,然后输入以下命令。
git status
  • 然后会显示 UserInterfaceState.xcuserstate 文件有改动,这时候复制 modified: 后面的地址。
git status
  • 接着输入 git rm --cached 刚才复制的地址 ,如下。
git rm --cached client_swift_fm_a/client_swift_fm_a.xcworkspace/xcuserdata/Jonzzs.xcuserdatad/UserInterfaceState.xcuserstate
  • 接着将代码提交推送到服务器。
git commit -m "删除xcuserstate文件"
git push
  • 之后再提交时就不会出现 UserInterfaceState.xcuserstate 文件了,要注意路径不能弄错,否则会报错。

将来的你,一定会感激现在拼命的自己,愿自己与读者的开发之路无限美好。

我的传送门: 博客简书微博GitHub

相关文章

网友评论

    本文标题:【iOS 开发】Git 中无法忽略 .xcuserstate 的

    本文链接:https://www.haomeiwen.com/subject/adumrxtx.html