【问题标题】:How can I make Xcode ignore xcodeproj in Xcode 9?如何让 Xcode 在 Xcode 9 中忽略 xcodeproj?
【发布时间】:2018-03-14 04:31:03
【问题描述】:
我一直在使用 Xcode9 开发一个 C 项目。我不想将我的 .xcodeproj 目录推送到 GitHub 中。我使用 Xcode 中的源代码控制菜单与 GitHub 同步。
我在 .gitignore 文件中添加了以下行:
*.xcodeproj/
DerivedData/
*.pbxproj
*xcworkspace
但它不会工作。当我提交时,Xcode 仍然会将我的 xcodeproj 目录推送到 GitHub 中。如何在 Xcode9 中忽略这些文件。
【问题讨论】:
标签:
xcode
git
github
xcode9
【解决方案1】:
这可能是因为这些文件已被跟踪(使 .gitignore 指令没有实际意义)
尝试从索引中删除它们
git rm --cached -r *.xcodeproj/
git rm --cached -r DerivedData/
git rm --cached -r *.pbxproj
git rm --cached -r *xcworkspace
--cached 选项将确保您将这些文件保留在磁盘上(并仅从索引中删除它们)。