xcode 我应该在 Swift 游乐场的 .gitignore 文件中包含什么?

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

What should I include in the .gitignore file for Swift playgrounds?

xcodegitswiftgitignoreswift-playground

提问by Dalija Prasnikar

I want to use Git for versioning my playgrounds, but I am not sure which files should be ignored and which ones I should commit.

我想使用 Git 对我的 Playground 进行版本控制,但我不确定应该忽略哪些文件以及应该提交哪些文件。

Currently I use following .gitignorefile for playgrounds:

目前,我将以下.gitignore文件用于游乐场:

# Xcode user data
xcuserdata

What else should be there?

还有什么应该在那里?

采纳答案by Damodaran

From the official github gitignore for Swift

来自官方github gitignore for Swift

## Playgrounds
timeline.xctimeline
playground.xcworkspace

回答by Suragch

Whether it is a normal project or playgrounds, it is convenient and useful to use one of the standard .gitignorefiles for Swift. From the terminal cdinto your project root folder (the one with the .xcodeproj file for a normal project) and run the following command:

无论是普通项目还是playgrounds,使用.gitignoreSwift的标准文件之一都是方便有用的。从终端cd进入您的项目根文件夹(普通项目的 .xcodeproj 文件)并运行以下命令:

curl -o .gitignore https://www.gitignore.io/api/swift

Or alternatively get it from the GitHub source:

或者从 GitHub 源获取它:

curl -o .gitignore https://raw.githubusercontent.com/github/gitignore/master/Swift.gitignore

You can edit the file to make changes if you need to. I just use the defaults.

如果需要,您可以编辑文件以进行更改。我只使用默认值。