iOS开发:告诉git不要跟踪UserInterfaceState.xcuserstate

时间:2024-01-16 11:37:20

在xcode中使用git管理项目的技巧:

在多人协作开发的时候,每个开发者都会在项目中的某个目录生成一个 UserInterfaceState.xcuserstate 文件,这个文件大概每5s会刷新一次,所以在push的时候总会提示有未提交的更改。

在项目的 .xcodeproj包里的有一个 UserInterfaceState.xcuserstate文件;如果使用了workspace来管理项目,也需要让git对workspace包里的 UserInterfaceState.xcuserstate文件不跟踪。

找到你项目中所有的 .xcuserstate文件,使用以下命令即可,记得每个成员都需要执行以下命令。

下次在提交的时候,就可以看到这个文件的状态为 ? ,不要勾选。

& git rm --cached 这里支持全局路径/UserInterfaceState.xcuserstate
& git commit -m "Removed file that shouldn't be tracked"