我使用Git进行Xcode 4项目版本控制。我明确地添加了ProjectFolder.xcodeproj/project.xcworkspace/xcuserdata/myUserName.xcuserdatad/UserInterfaceState。xcuserstate到.gitignore,但是Git不会忽略它。有人知道为什么吗?


当前回答

对我来说什么都没用,除了这个

把这条线加到你的gitignore里

*.xcuserdata

其他回答

这里有一个关于如何递归地从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" 为我工作!

如果在做了上面提到的所有事情之后文件仍然显示,请确保Xcode设置中的这个复选框是未选中的:

对我来说什么都没用,除了这个

把这条线加到你的gitignore里

*.xcuserdata

我觉得这样写比较好。

git rm——cache *//UserInterfaceState.xcuserstate**