iOS开发:git添加忽略文件:UserInterfaceState

来源:互联网 发布:石家庄网络教育 编辑:程序博客网 时间:2024/06/16 05:25

最近使用git 的时候遇到了个问题,就是commit时UserInterfaceState文件一直需要提交,由于这是用户信息状态文件,是一直变化的,这里我们需要把它添加进忽略文件,在网上找到一个可用的方法:

(原文地址:点击打开链接)

1. 退出xcdoe, 打开终端(Terminal),进入到你的项目目录下

2. 在终端键入  git rm --cached [YourProjectName].xcodeproj/project.xcworkspace/xcuserdata/[YourUsername].xcuserdatad/UserInterfaceState.xcuserstate
3. 在终端键入  git commit -m "Removed file that shouldn't be tracked"

4. 在.gitignore文件中加入如下几行

*.xcuserstate  project.xcworkspace  xcuserdata  UserInterfaceState.xcuserstate  project.xcworkspace/  xcuserdata/  UserInterface.xcuserstate  
5. 重新打开Xcode commit, push。



0 0