.gitignore 不适用于 XCode 项目中的 xcuserdata 目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25899469/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 05:35:40  来源:igfitidea点击:

.gitignore not working for xcuserdata directory in XCode project

iosxcodegit

提问by 0xSina

This is my gitignore file:

这是我的 gitignore 文件:

# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/

However, it still detects changes here:

但是,它仍然检测到这里的变化:

BW.xcodeproj/project.xcworkspace/xcuserdata/cooluser.xcuserdatad/UserInterfaceState.xcuserstate

This is on XCode 6.

这是在 XCode 6 上。

What am I doing wrong?

我究竟做错了什么?

Thanks!

谢谢!

回答by Kuhess

The file BW.xcodeproj/project.xcworkspace/[...]/UserInterfaceState.xcuserstatemust already be tracked by git.

该文件BW.xcodeproj/project.xcworkspace/[...]/UserInterfaceState.xcuserstate必须已被 git 跟踪。

When you add an entry to .gitignoreit only affects untracked files. If they are already tracked, they are not automatically removed from the repository.

当您向其中添加条目时.gitignore,只会影响未跟踪的文件。如果它们已经被跟踪,它们不会自动从存储库中删除。

You can remove this file manually with: git rm --cached BW.xcodeproj/project.xcworkspace

您可以使用以下命令手动删除此文件: git rm --cached BW.xcodeproj/project.xcworkspace