我可以从我的 git 存储库中“排除”哪些 Xcode 项目文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8628530/
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-14 22:49:51  来源:igfitidea点击:

Which Xcode project files can I 'exclude' from my git repo?

xcodegit

提问by milesmeow

I'm working on an iOS project and am using git to do version control. I'm working on this with another developer.

我正在处理一个 iOS 项目,并且正在使用 git 进行版本控制。我正在与另一位开发人员合作。

Which Xcode project files should I keep in the repo and which ones can I exclude so that it doesn't affect the other developer negatively?

我应该将哪些 Xcode 项目文件保留在 repo 中,哪些可以排除,以免对其他开发人员产生负面影响?

Here are some of the non-code files that git is telling me has been modified or added... (BTW, these are only viewable in the OSX file manager if you "Show Package Contents" for YourProject.xcodeproj file)

以下是 git 告诉我的一些非代码文件已被修改或添加......(顺便说一句,如果您为 YourProject.xcodeproj 文件“显示包内容”,这些文件只能在 OSX 文件管理器中查看)

exclude ?

排除 ?

  • contents.xcwordspacedata (I think this is just workspace settings)
  • UserInterfaceState.xcuserstate (based on the name it seems only specific to me)
  • Breakpoints.xcbkptlist (...my breakpoints settings)
  • contents.xcwordspacedata(我认为这只是工作区设置)
  • UserInterfaceState.xcuserstate(基于名称,它似乎只针对我)
  • Breakpoints.xcbkptlist(...我的断点设置)

INCLUDE ?

包括 ?

  • project.pbxproj (INCLUDE...project settings)
  • *.xscheme (INCLUDE...scheme definitions)
  • xschememanagement.plist (INCLUDE...scheme manager settings?)
  • project.pbxproj(包括...项目设置)
  • *.xscheme(包括...方案定义)
  • xschememanagement.plist(包括...方案管理器设置?)

Does this seem right?

这看起来对吗?

(Just an FYI for those that want to use the exclude feature of git. Edit your .git/info/exclude file in your local repository. Put in the files or the patterns for files that you want git to ignore. For example, if you want git to ignore foo.temp, bar.temp you can put a line in the file that says *.temp)

(对于那些想要使用 git 的排除功能的人仅供参考。在本地存储库中编辑您的 .git/info/exclude 文件。放入您希望 git 忽略的文件或文件的模式。例如,如果你想让 git 忽略 foo.temp, bar.temp 你可以在文件中放一行 *.temp)

回答by Kincade71

Think this is a great place to start Xcode .gitignore

认为这是开始Xcode的好地方.gitignore

# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata

## Other
*.xccheckout
*.moved-aside
*.xcuserstate

This one I modified Xcode .gitignoreI believe it to be more comprehensive.

这个我修改了Xcode .gitignore我相信它更全面。

# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata

## Other
*.xccheckout
*.moved-aside
*.xcuserstate
*.xcscmblueprint

## Obj-C/Swift specific
*.hmap
*.ipa

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-    pods-directory-into-source-control
#
#Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage    dependencies.
# Carthage/Checkouts

Carthage/Build

.DS_Store
.AppleDouble
.LSOverride

 # Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

The above adds CocoaPods, Carthage and some others that have shown up over time.

上面添加了 CocoaPods、Carthage 和其他一些已经出现的时间。

回答by Norman

This site(www.gitignore.io) lets you specify your IDE and or language and shows you a tailored .gitignore - Awesome site!

该站点(www.gitignore.io) 可让您指定 IDE 和/或语言,并向您展示定制的 .gitignore - 很棒的站点!

回答by Johannes Rudolph

You are definetely right about your includes, else you will be missing important information from your project file.

您对包含的内容完全正确,否则您将丢失项目文件中的重要信息。

For the excludes, I am myself excluding breakpoints and xcuserstate, but not xcworkspacedata, as I think it does store which projects are part of a workspace.

对于排除项,我自己排除断点和 xcuserstate,但不排除 xcworkspacedata,因为我认为它确实存储了哪些项目是工作区的一部分。