我使用Git进行Xcode 4项目版本控制。我明确地添加了ProjectFolder.xcodeproj/project.xcworkspace/xcuserdata/myUserName.xcuserdatad/UserInterfaceState。xcuserstate到.gitignore,但是Git不会忽略它。有人知道为什么吗?
当前回答
这里有一个关于如何递归地从git历史中删除有问题的文件的很好的解释:http://help.github.com/remove-sensitive-data/
非常有用,否则工具在试图显示那些不应该首先检查的巨大文件上的差异时往往会“挂起”……
以下是你可以做的(简而言之)来摆脱最大的东西:
cd YourProject
git filter-branch --index-filter 'git rm --cached --ignore-unmatch -r YourProject.xcodeproj/project.xcworkspace' HEAD
# see what you want to do with your remote here...
# you can: git push origin master --force
# or you can delete it and push a fresh new one from your cleaned-up local...
rm -rf .git/refs/original
git gc --prune=now
git gc --aggressive --prune=now
对我来说非常有用:)
其他回答
这里有一个关于如何递归地从git历史中删除有问题的文件的很好的解释:http://help.github.com/remove-sensitive-data/
非常有用,否则工具在试图显示那些不应该首先检查的巨大文件上的差异时往往会“挂起”……
以下是你可以做的(简而言之)来摆脱最大的东西:
cd YourProject
git filter-branch --index-filter 'git rm --cached --ignore-unmatch -r YourProject.xcodeproj/project.xcworkspace' HEAD
# see what you want to do with your remote here...
# you can: git push origin master --force
# or you can delete it and push a fresh new one from your cleaned-up local...
rm -rf .git/refs/original
git gc --prune=now
git gc --aggressive --prune=now
对我来说非常有用:)
只是 "git clean -f -d" 为我工作!
对我来说什么都没用,除了这个
把这条线加到你的gitignore里
*.xcuserdata
如果你使用GitHub,这里有一些演示和快捷方式,基本思想是一样的。
1. 像这样打开终端
2. 将下面的命令粘贴到终端,后面加一个空格,然后像这样粘贴.xcuserstate文件的路径
Git rm——缓存
3.确保你有正确的git忽略,然后提交代码:)
有个朋友给我看了这个很棒的网站https://www.gitignore.io/。输入您选择的IDE或其他选项,它将自动生成一个由有用的忽略组成的gitignore文件,其中之一是xcuserstate。您可以在下载之前预览gitignore文件。
推荐文章
- git pull -rebase和git pull -ff-only之间的区别
- GitHub -致命:无法读取用户名https://github.com':没有这样的文件或目录
- 撤消git平分错误
- 使用.gitconfig配置diff工具
- Xcode 4挂在“附加到(应用程序名称)”
- 为什么单元测试中的代码不能找到包资源?
- 如何配置Mac OS X术语,使git有颜色?
- Visual Studio Code: .git文件夹/文件隐藏
- “node_modules”文件夹应该包含在git存储库中吗
- 为什么git-rebase给了我合并冲突,而我所做的只是压缩提交?
- Xcode 10的对象库去哪了?
- 当我试图推到原点时,为什么Git告诉我“没有这样的远程‘原点’”?
- 如何从远程分支中挑选?
- 如何查看一个分支中的哪些提交不在另一个分支中?
- 如何取消在github上的拉请求?