git添加.xcuserstate忽略

iOS项目,添加忽略文件后发现UserInterfaceState.xcuserstate还是没忽略。

.xcuserstate是什么

看起来像是什么记录状态的文件。

xcuserstate files are generated from within Xcode and saved in your project bundle to remember your last opened file, the open state of any group folders, open tabs, and any other user setting your project might need to remember. For purposes of revision control, you should ignore them or leave them out if at all possible.

上面是stackoverflow说的,这个文件打不开,也不清楚用什么去查看里面到底是什么内容。

如何忽略.xcuserstate

需要做如下几步处理:

  1. 添加忽略内容到.gitignore
cd Project/.../...   # 进入到本地git仓库
ls -la				 # 查看所有文件
open .gitignore 	# 打开gitignore文件

在里面添加下面的忽略内容

*.xcuserstate
project.xcworkspace
xcuserdata
UserInterfaceState.xcuserstate
project.xcworkspace/
xcuserdata/
UserInterface.xcuserstate

添加并保存。

  1. 删除仓库暂存区.xcuserstate的缓存并提交
git rm --cached Project/xxx.xcworkspace/xcuserdata/xxx.xcuserdatad/UserInterfaceState.xcuserstate
➜  xxx git:(master) ✗ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	modified:   .gitignore
	deleted:    Project/MMVoiceEngine.xcworkspace/xcuserdata/encompass.xcuserdatad/UserInterfaceState.xcuserstate
git add .
git commit -m "添加UserInterfaceState.xcuserstate忽略"
git pull
git push
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Morris_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值